Skip to content

Commit 376fb48

Browse files
committed
Ignore RDS and ElasticBeanstalk system tags.
1 parent 161afa0 commit 376fb48

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/provider/fwprovider/intercept.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,14 @@ func (r tagsInterceptor) create(ctx context.Context, request resource.CreateRequ
312312
// Merge the resource's configured tags with any provider configured default_tags.
313313
tags := tagsInContext.DefaultConfig.MergeTags(tftags.New(ctx, planTags))
314314
// Remove system tags.
315-
tags = tags.IgnoreAWS()
315+
tags = tags.IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS()
316316

317317
tagsInContext.TagsIn = types.Some(tags)
318318
case After:
319319
// Set values for unknowns.
320320
// Remove any provider configured ignore_tags and system tags from those passed to the service API.
321321
// Computed tags_all include any provider configured default_tags.
322-
stateTagsAll := flex.FlattenFrameworkStringValueMapLegacy(ctx, tagsInContext.TagsIn.MustUnwrap().IgnoreAWS().IgnoreConfig(tagsInContext.IgnoreConfig).Map())
322+
stateTagsAll := flex.FlattenFrameworkStringValueMapLegacy(ctx, tagsInContext.TagsIn.MustUnwrap().IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS().IgnoreConfig(tagsInContext.IgnoreConfig).Map())
323323
diags.Append(response.State.SetAttribute(ctx, path.Root(names.AttrTagsAll), &stateTagsAll)...)
324324

325325
if diags.HasError() {
@@ -409,7 +409,7 @@ func (r tagsInterceptor) read(ctx context.Context, request resource.ReadRequest,
409409
stateTags := tftags.Null
410410
// Remove any provider configured ignore_tags and system tags from those returned from the service API.
411411
// The resource's configured tags do not include any provider configured default_tags.
412-
if v := apiTags.IgnoreAWS().IgnoreConfig(tagsInContext.IgnoreConfig).RemoveDefaultConfig(tagsInContext.DefaultConfig).Map(); len(v) > 0 {
412+
if v := apiTags.IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS().IgnoreConfig(tagsInContext.IgnoreConfig).RemoveDefaultConfig(tagsInContext.DefaultConfig).Map(); len(v) > 0 {
413413
stateTags = flex.FlattenFrameworkStringValueMapLegacy(ctx, v)
414414
}
415415
diags.Append(response.State.SetAttribute(ctx, path.Root(names.AttrTags), &stateTags)...)
@@ -419,7 +419,7 @@ func (r tagsInterceptor) read(ctx context.Context, request resource.ReadRequest,
419419
}
420420

421421
// Computed tags_all do.
422-
stateTagsAll := flex.FlattenFrameworkStringValueMapLegacy(ctx, apiTags.IgnoreAWS().IgnoreConfig(tagsInContext.IgnoreConfig).Map())
422+
stateTagsAll := flex.FlattenFrameworkStringValueMapLegacy(ctx, apiTags.IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS().IgnoreConfig(tagsInContext.IgnoreConfig).Map())
423423
diags.Append(response.State.SetAttribute(ctx, path.Root(names.AttrTagsAll), &stateTagsAll)...)
424424

425425
if diags.HasError() {
@@ -476,7 +476,7 @@ func (r tagsInterceptor) update(ctx context.Context, request resource.UpdateRequ
476476
// Merge the resource's configured tags with any provider configured default_tags.
477477
tags := tagsInContext.DefaultConfig.MergeTags(tftags.New(ctx, planTags))
478478
// Remove system tags.
479-
tags = tags.IgnoreAWS()
479+
tags = tags.IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS()
480480

481481
tagsInContext.TagsIn = types.Some(tags)
482482

internal/provider/intercept.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (r tagsInterceptor) run(ctx context.Context, d *schema.ResourceData, meta a
222222
// Merge the resource's configured tags with any provider configured default_tags.
223223
tags := tagsInContext.DefaultConfig.MergeTags(tftags.New(ctx, d.Get(names.AttrTags).(map[string]interface{})))
224224
// Remove system tags.
225-
tags = tags.IgnoreAWS()
225+
tags = tags.IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS()
226226

227227
tagsInContext.TagsIn = types.Some(tags)
228228

@@ -321,7 +321,7 @@ func (r tagsInterceptor) run(ctx context.Context, d *schema.ResourceData, meta a
321321
}
322322

323323
// Remove any provider configured ignore_tags and system tags from those returned from the service API.
324-
tags := tagsInContext.TagsOut.UnwrapOrDefault().IgnoreAWS().IgnoreConfig(tagsInContext.IgnoreConfig)
324+
tags := tagsInContext.TagsOut.UnwrapOrDefault().IgnoreAWS().IgnoreElasticbeanstalk().IgnoreRDS().IgnoreConfig(tagsInContext.IgnoreConfig)
325325

326326
// The resource's configured tags do not include any provider configured default_tags.
327327
if err := d.Set(names.AttrTags, tags.RemoveDefaultConfig(tagsInContext.DefaultConfig).Map()); err != nil {

0 commit comments

Comments
 (0)