diff --git a/internal/service/elbv2/listener_rule_data_source.go b/internal/service/elbv2/listener_rule_data_source.go index 2b7f2587a14..38dd80af56e 100644 --- a/internal/service/elbv2/listener_rule_data_source.go +++ b/internal/service/elbv2/listener_rule_data_source.go @@ -24,8 +24,7 @@ import ( ) // @FrameworkDataSource("aws_lb_listener_rule", name="Listener Rule") -// @Testing(tagsTest=true) -// @Testing(tagsIdentifierAttribute="arn") +// @Tags(identifierAttribute="arn") func newDataSourceListenerRule(context.Context) (datasource.DataSourceWithConfigure, error) { return &dataSourceListenerRule{}, nil } @@ -349,14 +348,6 @@ func (d *dataSourceListenerRule) Read(ctx context.Context, req datasource.ReadRe } data.Priority = types.Int32Value(int32(priority)) - tags, err := listTags(ctx, conn, aws.ToString(out.RuleArn)) - if err != nil { - resp.Diagnostics.AddError("listing tags for ELBv2 Listener Rule", err.Error()) - return - } - ignoreTagsConfig := d.Meta().IgnoreTagsConfig(ctx) - data.Tags = tftags.FlattenStringValueMap(ctx, tags.IgnoreAWS().IgnoreConfig(ignoreTagsConfig).Map()) - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } diff --git a/internal/service/elbv2/listener_rule_data_source_tags_gen_test.go b/internal/service/elbv2/listener_rule_data_source_tags_gen_test.go index a0958574d2f..24112d53247 100644 --- a/internal/service/elbv2/listener_rule_data_source_tags_gen_test.go +++ b/internal/service/elbv2/listener_rule_data_source_tags_gen_test.go @@ -3,7 +3,6 @@ package elbv2_test import ( - "context" "testing" "github.com/hashicorp/terraform-plugin-testing/config" @@ -13,9 +12,6 @@ import ( "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" - tfstatecheck "github.com/hashicorp/terraform-provider-aws/internal/acctest/statecheck" - tfelbv2 "github.com/hashicorp/terraform-provider-aws/internal/service/elbv2" - "github.com/hashicorp/terraform-provider-aws/internal/types" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -155,7 +151,7 @@ func TestAccELBV2ListenerRuleDataSource_tags_IgnoreTags_Overlap_DefaultTag(t *te statecheck.ExpectKnownValue(dataSourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), })), - expectFullListenerRuleDataSourceTags(dataSourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + expectFullDataSourceTags(dataSourceName, knownvalue.MapExact(map[string]knownvalue.Check{ acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), })), @@ -188,7 +184,7 @@ func TestAccELBV2ListenerRuleDataSource_tags_IgnoreTags_Overlap_ResourceTag(t *t }, ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(dataSourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{})), - expectFullListenerRuleDataSourceTags(dataSourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + expectFullDataSourceTags(dataSourceName, knownvalue.MapExact(map[string]knownvalue.Check{ acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), })), }, @@ -197,9 +193,3 @@ func TestAccELBV2ListenerRuleDataSource_tags_IgnoreTags_Overlap_ResourceTag(t *t }, }) } - -func expectFullListenerRuleDataSourceTags(resourceAddress string, knownValue knownvalue.Check) statecheck.StateCheck { - return tfstatecheck.ExpectFullDataSourceTagsSpecTags(tfelbv2.ServicePackage(context.Background()), resourceAddress, &types.ServicePackageResourceTags{ - IdentifierAttribute: names.AttrARN, - }, knownValue) -} diff --git a/internal/service/elbv2/service_package_gen.go b/internal/service/elbv2/service_package_gen.go index f012ce0f6d1..79da0a8c05e 100644 --- a/internal/service/elbv2/service_package_gen.go +++ b/internal/service/elbv2/service_package_gen.go @@ -19,6 +19,9 @@ func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.Serv { Factory: newDataSourceListenerRule, Name: "Listener Rule", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: names.AttrARN, + }, }, } }