Skip to content

Commit

Permalink
Merge pull request #39092 from acwwat/f-aws_transfer_server-add_tags_…
Browse files Browse the repository at this point in the history
…to_data_source

feat: Add tags attr to d/aws_transfer_server
  • Loading branch information
ewbankkit authored Sep 3, 2024
2 parents 89589c6 + 50cc281 commit 6c16269
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/39092.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data-source/aws_transfer_server: Add `tags` attribute
```
5 changes: 5 additions & 0 deletions internal/service/transfer/server_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -79,6 +81,7 @@ func dataSourceServer() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
names.AttrTags: tftags.TagsSchemaComputed(),
},
}
}
Expand Down Expand Up @@ -116,5 +119,7 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte
d.Set(names.AttrURL, "")
}

setTagsOut(ctx, output.Tags)

return diags
}
5 changes: 5 additions & 0 deletions internal/service/transfer/server_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
},
},
Expand Down Expand Up @@ -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" {
Expand Down
3 changes: 3 additions & 0 deletions internal/service/transfer/service_package_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions website/docs/d/transfer_server.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

0 comments on commit 6c16269

Please sign in to comment.