@@ -1319,7 +1319,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte
1319
1319
return sdkdiag .AppendErrorf (diags , "reading EC2 Instance (%s): %s" , d .Id (), err )
1320
1320
}
1321
1321
1322
- if err := readBlockDevices (ctx , d , meta , instance ); err != nil {
1322
+ if err := readBlockDevices (ctx , d , meta , instance , false ); err != nil {
1323
1323
return sdkdiag .AppendErrorf (diags , "reading EC2 Instance (%s): %s" , d .Id (), err )
1324
1324
}
1325
1325
@@ -2161,8 +2161,8 @@ func modifyInstanceAttributeWithStopStart(ctx context.Context, conn *ec2.EC2, in
2161
2161
return nil
2162
2162
}
2163
2163
2164
- func readBlockDevices (ctx context.Context , d * schema.ResourceData , meta interface {}, instance * ec2.Instance ) error {
2165
- ibds , err := readBlockDevicesFromInstance (ctx , d , meta , instance )
2164
+ func readBlockDevices (ctx context.Context , d * schema.ResourceData , meta interface {}, instance * ec2.Instance , ds bool ) error {
2165
+ ibds , err := readBlockDevicesFromInstance (ctx , d , meta , instance , ds )
2166
2166
if err != nil {
2167
2167
return fmt .Errorf ("reading block devices: %w" , err )
2168
2168
}
@@ -2213,7 +2213,7 @@ func readBlockDevices(ctx context.Context, d *schema.ResourceData, meta interfac
2213
2213
return nil
2214
2214
}
2215
2215
2216
- func readBlockDevicesFromInstance (ctx context.Context , d * schema.ResourceData , meta interface {}, instance * ec2.Instance ) (map [string ]interface {}, error ) {
2216
+ func readBlockDevicesFromInstance (ctx context.Context , d * schema.ResourceData , meta interface {}, instance * ec2.Instance , ds bool ) (map [string ]interface {}, error ) {
2217
2217
blockDevices := make (map [string ]interface {})
2218
2218
blockDevices ["ebs" ] = make ([]map [string ]interface {}, 0 )
2219
2219
blockDevices ["root" ] = nil
@@ -2279,9 +2279,13 @@ func readBlockDevicesFromInstance(ctx context.Context, d *schema.ResourceData, m
2279
2279
bd ["device_name" ] = aws .StringValue (instanceBd .DeviceName )
2280
2280
}
2281
2281
if v , ok := d .GetOk ("volume_tags" ); ! ok || v == nil || len (v .(map [string ]interface {})) == 0 {
2282
- tags := KeyValueTags (ctx , vol .Tags ).IgnoreAWS ().IgnoreConfig (ignoreTagsConfig )
2283
- bd [names .AttrTags ] = tags .RemoveDefaultConfig (defaultTagsConfig ).Map ()
2284
- bd [names .AttrTagsAll ] = tags .Map ()
2282
+ if ds {
2283
+ bd [names .AttrTags ] = KeyValueTags (ctx , vol .Tags ).IgnoreAWS ().IgnoreConfig (ignoreTagsConfig ).Map ()
2284
+ } else {
2285
+ tags := KeyValueTags (ctx , vol .Tags ).IgnoreAWS ().IgnoreConfig (ignoreTagsConfig )
2286
+ bd [names .AttrTags ] = tags .RemoveDefaultConfig (defaultTagsConfig ).Map ()
2287
+ bd [names .AttrTagsAll ] = tags .Map ()
2288
+ }
2285
2289
}
2286
2290
2287
2291
if blockDeviceIsRoot (instanceBd , instance ) {
0 commit comments