Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tags attr to d/aws_transfer_server #39092

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.
Loading