Skip to content

[New Resources]aws_transfer_web_app and aws_transfer_web_app_customization #42708

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

tabito-hara
Copy link
Contributor

@tabito-hara tabito-hara commented May 21, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

  • Added new resources: aws_transfer_web_app and aws_transfer_web_app_customization.

aws_transfer_web_app

  • IdentityProviderDetails and WebUnits are union types. Their expander and flattener are manually implemented.
  • The AWS APIs CreateWebApp and UpdateWebApp return only a WebAppId. Other attributes are retrieved using a finder function and set in the Terraform state.
  • Waiters are implemented for creation and deletion, but not for update, since there are no attributes that indicate update status.

aws_transfer_web_app_customization

  • The UpdateWebAppCustomization method in the AWS SDK for Go accepts raw bytes for the logo and favicon files and automatically encodes them as base64 strings. Since Terraform arguments must be strings, the input is expected to be base64-encoded strings. These are decoded in the manually implemented expander before being passed to the SDK method. In the flattener process, the SDK’s output is re-encoded as base64 strings to store in the Terraform state.
  • If favicon_file is not specified, the existing file remains unchanged. Therefore, it is marked as both Optional and Computed. The same applies to logo_file.
  • To remove the title, an empty string ("") must be passed to the API. However, when the title is updated to an empty string, the response from DescribeWebAppCustomization omits the Title key. In Terraform, if title = "" is specified, the resulting state after apply shows title = null, leading to a mismatch between the plan ("") and the post-apply state (null), which causes an error.
  • I attempted to resolve this inconsistency by modifying the flattener process to replace null values of title with empty strings, but this approach did not work as expected. Specifically, if the title argument itself is null, the plan contains null, while the flattener still outputs an empty string ("") for the state, resulting in a new inconsistency.
  • Since the title argument is not marked as Computed, removing it from the configuration resets the title to an empty string. Based on this behavior, the title argument must have a length between 1 and 100, meaning an empty string cannot be used.

Acceptance Tests

  • Each acceptance test focuses on a single argument and verifies the following:

    • Initial resource creation
    • Import
    • Updating the argument
    • Updating by removing the argument from the configuration
  • For logo and favicon files, product logos obtained from the [HashiCorp Website](https://brand.hashicorp.com/product_logos) are used.

Relations

Closes #40996

References

https://docs.aws.amazon.com/transfer/latest/APIReference/API_CreateWebApp.html
https://docs.aws.amazon.com/transfer/latest/APIReference/API_UpdateWebApp.html
https://docs.aws.amazon.com/transfer/latest/APIReference/API_DescribeWebApp.html

https://docs.aws.amazon.com/transfer/latest/APIReference/API_UpdateWebAppCustomization.html
https://docs.aws.amazon.com/transfer/latest/APIReference/API_DescribeWebAppCustomization.html

Output from Acceptance Testing

$ AWS_DEFAULT_REGION=ap-northeast-1 ACCTEST_PARALLELISM=2 make testacc TESTS=TestAccTransferWebApp_ PKG=transfer               
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.8 test ./internal/service/transfer/... -v -count 1 -parallel 2 -run='TestAccTransferWebApp_'  -timeout 360m -vet=off
2025/05/22 01:41:28 Initializing Terraform AWS Provider...
=== RUN   TestAccTransferWebApp_basic
=== PAUSE TestAccTransferWebApp_basic
=== RUN   TestAccTransferWebApp_webAppUnits
=== PAUSE TestAccTransferWebApp_webAppUnits
=== RUN   TestAccTransferWebApp_accessEndpoint
=== PAUSE TestAccTransferWebApp_accessEndpoint
=== RUN   TestAccTransferWebApp_tags
=== PAUSE TestAccTransferWebApp_tags
=== RUN   TestAccTransferWebApp_disappears
=== PAUSE TestAccTransferWebApp_disappears
=== CONT  TestAccTransferWebApp_basic
=== CONT  TestAccTransferWebApp_tags
--- PASS: TestAccTransferWebApp_basic (43.39s)
=== CONT  TestAccTransferWebApp_accessEndpoint
--- PASS: TestAccTransferWebApp_tags (61.68s)
=== CONT  TestAccTransferWebApp_webAppUnits
--- PASS: TestAccTransferWebApp_accessEndpoint (29.13s)
=== CONT  TestAccTransferWebApp_disappears
--- PASS: TestAccTransferWebApp_disappears (16.61s)
--- PASS: TestAccTransferWebApp_webAppUnits (28.56s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/transfer   93.824s
$ AWS_DEFAULT_REGION=ap-northeast-1 ACCTEST_PARALLELISM=2 make testacc TESTS=TestAccTransferWebAppCustomization_ PKG=transfer
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.8 test ./internal/service/transfer/... -v -count 1 -parallel 2 -run='TestAccTransferWebAppCustomization_'  -timeout 360m -vet=off
2025/05/22 01:43:44 Initializing Terraform AWS Provider...
=== RUN   TestAccTransferWebAppCustomization_basic
=== PAUSE TestAccTransferWebAppCustomization_basic
=== RUN   TestAccTransferWebAppCustomization_files
=== PAUSE TestAccTransferWebAppCustomization_files
=== RUN   TestAccTransferWebAppCustomization_disappears
=== PAUSE TestAccTransferWebAppCustomization_disappears
=== CONT  TestAccTransferWebAppCustomization_basic
=== CONT  TestAccTransferWebAppCustomization_disappears
--- PASS: TestAccTransferWebAppCustomization_disappears (19.36s)
=== CONT  TestAccTransferWebAppCustomization_files
--- PASS: TestAccTransferWebAppCustomization_basic (31.18s)
--- PASS: TestAccTransferWebAppCustomization_files (36.87s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/transfer   60.847s

Copy link

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/transfer Issues and PRs that pertain to the transfer service. sweeper Pertains to changes to or issues with the sweeper. generators Relates to code generators. size/XL Managed by automation to categorize the size of a PR. labels May 21, 2025
@tabito-hara tabito-hara force-pushed the f-aws_transfer_web_app branch from 41c3e3a to f839655 Compare May 21, 2025 17:15
@tabito-hara tabito-hara force-pushed the f-aws_transfer_web_app branch from f839655 to 8b3f48e Compare May 21, 2025 17:33
@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels May 21, 2025
@tabito-hara tabito-hara marked this pull request as ready for review May 22, 2025 16:16
@tabito-hara tabito-hara requested a review from a team as a code owner May 22, 2025 16:16
@tabito-hara tabito-hara marked this pull request as draft May 23, 2025 08:29
@tabito-hara tabito-hara marked this pull request as ready for review May 23, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-resource Introduces a new resource. service/transfer Issues and PRs that pertain to the transfer service. size/XL Managed by automation to categorize the size of a PR. sweeper Pertains to changes to or issues with the sweeper. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New Resource]: AWS Transfer Family web apps
2 participants