From c6a05bcea7c26eef03767082d056360ebaf4090e Mon Sep 17 00:00:00 2001 From: Anthony Wat Date: Thu, 29 Aug 2024 22:42:20 -0400 Subject: [PATCH 1/3] feat: Add tags attr to d/aws_transfer_server --- .changelog/39092.txt | 3 +++ internal/service/transfer/server_data_source.go | 3 +++ internal/service/transfer/server_data_source_test.go | 5 +++++ internal/service/transfer/service_package_gen.go | 3 +++ website/docs/d/transfer_server.html.markdown | 1 + 5 files changed, 15 insertions(+) create mode 100644 .changelog/39092.txt diff --git a/.changelog/39092.txt b/.changelog/39092.txt new file mode 100644 index 00000000000..ac9d2808ba6 --- /dev/null +++ b/.changelog/39092.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_transfer_server: Add `tags` argument +``` \ No newline at end of file diff --git a/internal/service/transfer/server_data_source.go b/internal/service/transfer/server_data_source.go index bd3e88cd02a..80c7c8c9bfb 100644 --- a/internal/service/transfer/server_data_source.go +++ b/internal/service/transfer/server_data_source.go @@ -12,10 +12,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_transfer_server", name="Server") +// @Tags(identifierAttribute="arn") func dataSourceServer() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceServerRead, @@ -79,6 +81,7 @@ func dataSourceServer() *schema.Resource { Type: schema.TypeString, Computed: true, }, + names.AttrTags: tftags.TagsSchemaComputed(), }, } } diff --git a/internal/service/transfer/server_data_source_test.go b/internal/service/transfer/server_data_source_test.go index a6117bfe8fe..4e7b4cb9900 100644 --- a/internal/service/transfer/server_data_source_test.go +++ b/internal/service/transfer/server_data_source_test.go @@ -32,6 +32,8 @@ func testAccServerDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), resource.TestCheckResourceAttrPair(datasourceName, "structured_log_destinations.#", resourceName, "structured_log_destinations.#"), + resource.TestCheckResourceAttrPair(datasourceName, acctest.CtTagsPercent, resourceName, acctest.CtTagsPercent), + resource.TestCheckResourceAttrPair(datasourceName, acctest.CtTagsKey1, resourceName, acctest.CtTagsKey1), ), }, }, @@ -147,6 +149,9 @@ POLICY resource "aws_transfer_server" "test" { identity_provider_type = "SERVICE_MANAGED" logging_role = aws_iam_role.test.arn + tags = { + "key1" = "value1" + } } data "aws_transfer_server" "test" { diff --git a/internal/service/transfer/service_package_gen.go b/internal/service/transfer/service_package_gen.go index bc8c64632f3..5add8876aa8 100644 --- a/internal/service/transfer/service_package_gen.go +++ b/internal/service/transfer/service_package_gen.go @@ -33,6 +33,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Factory: dataSourceServer, TypeName: "aws_transfer_server", Name: "Server", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: names.AttrARN, + }, }, } } diff --git a/website/docs/d/transfer_server.html.markdown b/website/docs/d/transfer_server.html.markdown index 53ec9368ca2..0dd21ab7f6c 100644 --- a/website/docs/d/transfer_server.html.markdown +++ b/website/docs/d/transfer_server.html.markdown @@ -38,4 +38,5 @@ This data source exports the following attributes in addition to the arguments a * `protocols` - File transfer protocol or protocols over which your file transfer protocol client can connect to your server's endpoint. * `security_policy_name` - The name of the security policy that is attached to the server. * `structured_log_destinations` - A set of ARNs of destinations that will receive structured logs from the transfer server such as CloudWatch Log Group ARNs. +* `tags` - Map of tags assigned to the resource. * `url` - URL of the service endpoint used to authenticate users with an `identity_provider_type` of `API_GATEWAY`. From b610ac90fdd98b0d11084c8e4431f20e290ddbbc Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 3 Sep 2024 09:35:42 -0400 Subject: [PATCH 2/3] Update 39092.txt --- .changelog/39092.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changelog/39092.txt b/.changelog/39092.txt index ac9d2808ba6..fee62b1a0b6 100644 --- a/.changelog/39092.txt +++ b/.changelog/39092.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -resource/aws_transfer_server: Add `tags` argument -``` \ No newline at end of file +data-source/aws_transfer_server: Add `tags` attribute +``` From 50cc281655fb2121903ccac1cbd88f5517f0433b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 3 Sep 2024 09:37:58 -0400 Subject: [PATCH 3/3] d/aws_transfer_server: Add call to 'setTagsOut'. --- internal/service/transfer/server_data_source.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/service/transfer/server_data_source.go b/internal/service/transfer/server_data_source.go index 80c7c8c9bfb..52abe2a35d9 100644 --- a/internal/service/transfer/server_data_source.go +++ b/internal/service/transfer/server_data_source.go @@ -119,5 +119,7 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrURL, "") } + setTagsOut(ctx, output.Tags) + return diags }