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

Allow AWS Local Zones (LocalZone) as locationType F_aws_s3 directory_bucket_enchancements #40944

Merged

Conversation

romsrb
Copy link
Contributor

@romsrb romsrb commented Jan 15, 2025

Description

Adds support for

  • Allow AWS Local Zones (LocalZone) as locationType F_aws_s3 directory_bucket_enchancements
  • S3 directory bucket with DataRedundancy as SingleLocalZone

Changes below include:

  • [directory_bucket.go] : Added a new location type of LocalZone to create a directory bucket and DataRedundancy = SingleLocalZone
  • [data_redundancy_plan_modifier.go] : Added a file for the schema to replace the default DataRedundancy, when a locationType =LocalZone
  • [location_info_model.go] : shifted the struct LocationInfoModel from directory_bucket.go to models folder so that the struct values can be used by data_redundancy_plan_modifier as well.

Changes above do not impact when location type = "AvailabilityZone"

Relations

Closes #0000

References

Output from Acceptance Testing

  1. make testacc TESTS=TestAccS3DirectoryBucket_LocationTypeValidation PKG=s3
    Output :
2025/01/17 17:56:50 Initializing Terraform AWS Provider...
=== RUN   TestAccS3DirectoryBucket_LocationTypeValidation
=== PAUSE TestAccS3DirectoryBucket_LocationTypeValidation
=== CONT  TestAccS3DirectoryBucket_LocationTypeValidation
--- PASS: TestAccS3DirectoryBucket_LocationTypeValidation (2.27s)
PASS
ok  github.com/hashicorp/terraform-provider-aws/internal/service/s3	2.431s

  1. make testacc TESTS=TestAccS3DirectoryBucket_dataRedundancyValidation PKG=s3
    Output :
2025/01/17 17:58:14 Initializing Terraform AWS Provider...
=== RUN   TestAccS3DirectoryBucket_dataRedundancyValidation
=== PAUSE TestAccS3DirectoryBucket_dataRedundancyValidation
=== CONT  TestAccS3DirectoryBucket_dataRedundancyValidation
--- PASS: TestAccS3DirectoryBucket_dataRedundancyValidation (1.48s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	1.630s
  1. make testacc TESTS=TestAccS3DirectoryBucket_dataRedundancyEmpty PKG=s3
    Output:
TF_ACC=1 go1.23.3 test ./internal/service/s3/... -v -count 1 -parallel 20 -run='TestAccS3DirectoryBucket_dataRedundancyEmpty'  -timeout 360m
2025/01/23 05:22:06 Initializing Terraform AWS Provider...
=== RUN   TestAccS3DirectoryBucket_dataRedundancyEmpty
=== PAUSE TestAccS3DirectoryBucket_dataRedundancyEmpty
=== CONT  TestAccS3DirectoryBucket_dataRedundancyEmpty
--- PASS: TestAccS3DirectoryBucket_dataRedundancyEmpty (1.59s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	1.747s
  1. make testacc TESTS=TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic PKG=s3
    Output :
TF_ACC=1 go1.23.3 test ./internal/service/s3/... -v -count 1 -parallel 20 -run='TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic'  -timeout 360m
=== RUN   TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic
=== PAUSE TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic
=== CONT  TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic
--- PASS: TestAccS3DirectoryBucket_DataRedundancyPlanModifier_Basic (17.80s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	17.961s
  1. make testacc TESTS=TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected PKG=s3
    Output:
TF_ACC=1 go1.23.3 test ./internal/service/s3/... -v -count 1 -parallel 20 -run='TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected'  -timeout 360m
=== RUN   TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected
=== PAUSE TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected
=== CONT  TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected
--- PASS: TestAccS3DirectoryBucket_LocationTypeValidation_Unexpected (1.60s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	1.762s

Below are the testing scenarios performed locally on AZ and LZ AWS accounts.

  • Performed successful local test by updating the main.tf file to create directoryBucket in localZone/AvailabilityZone
  • Verified the test scenarios as below using the terraform config setup :
    • Setup created for AvailabilityZone region:
      • Added LocalZone in location type, create bucket failed with the following error : Invalid Data Redundancy value for Bucket configuration.
      • Added AvailabilityZone in location type: bucket created successfully.
      • Removed location Type and DataRedundancy(DR) from the terraform config, bucket successfully created in AZ
      • Passed DR value as SingleAvailabilityZone, bucket creation was successful.
      • Passed DR value as SingleLocalZone, bucket creation failed with the following error : Invalid Data Redundancy value for Bucket configuration.
      • Passed Location Type as LocalZone and DR as SingleLocalZone, bucket creation failed with the below error :
        Invalid Data Redundancy value for Bucket configuration.

    • Setup created for LocalZone region:
      - Added AvailabilityZone in location type, bucket creation failed with the following error : InvalidRequest: Invalid Type value for Location configuration.
      - Removed location Type and DataRedundancy(DR) from the terraform config, bucket creation failed with the following error : InvalidRequest: Invalid Data Redundancy value for Bucket configuration. , since passing it as null sets the default values for both LocationType and DataRedundancy
      - Added LocalZone in location type: bucket created successfully.
      - Passed DR value as SingleLocalZone and LocationType as LocalZone, bucket creation was successful.
      - Passed DR value as SingleAvailabilityZone, bucket creation failed with the following error : InvalidRequest: Invalid Type value for Location configuration.

...

@romsrb romsrb requested a review from a team as a code owner January 15, 2025 15:32
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • 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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/s3 Issues and PRs that pertain to the s3 service. needs-triage Waiting for first response or review from a maintainer. labels Jan 15, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @romsrb 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jan 15, 2025
@romsrb romsrb marked this pull request as draft January 16, 2025 02:27
@romsrb romsrb marked this pull request as ready for review January 23, 2025 13:50
@romsrb romsrb changed the title Allow LocalZone as locationType F_aws_s3 directory_bucket_enchancements Allow AWS Local Zones (LocalZone) as locationType F_aws_s3 directory_bucket_enchancements Feb 6, 2025
@ewbankkit ewbankkit self-assigned this Feb 26, 2025
@github-actions github-actions bot added partner Contribution from a partner. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Feb 26, 2025
@ewbankkit
Copy link
Contributor

ewbankkit commented Feb 26, 2025

Relates #40383.
Relates #40339.

% make testacc TESTARGS='-run=TestAccS3DirectoryBucket_' PKG=s3 ACCTEST_PARALLELISM=4
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/s3/... -v -count 1 -parallel 4  -run=TestAccS3DirectoryBucket_ -timeout 360m -vet=off
2025/02/26 16:55:51 Initializing Terraform AWS Provider...
=== RUN   TestAccS3DirectoryBucket_basic
=== PAUSE TestAccS3DirectoryBucket_basic
=== RUN   TestAccS3DirectoryBucket_disappears
=== PAUSE TestAccS3DirectoryBucket_disappears
=== RUN   TestAccS3DirectoryBucket_forceDestroy
=== PAUSE TestAccS3DirectoryBucket_forceDestroy
=== RUN   TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
=== PAUSE TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
=== CONT  TestAccS3DirectoryBucket_basic
=== CONT  TestAccS3DirectoryBucket_forceDestroy
=== CONT  TestAccS3DirectoryBucket_disappears
=== CONT  TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
--- PASS: TestAccS3DirectoryBucket_disappears (15.56s)
--- PASS: TestAccS3DirectoryBucket_forceDestroy (15.58s)
--- PASS: TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes (15.64s)
--- PASS: TestAccS3DirectoryBucket_basic (17.87s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	23.684s
@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 27, 2025
ewbankkit
ewbankkit previously approved these changes Feb 27, 2025
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccS3DirectoryBucket_\|TestAccS3Bucket_Basic\|TestAccS3Bucket_disappears' PKG=s3 ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/s3/... -v -count 1 -parallel 3  -run=TestAccS3DirectoryBucket_\|TestAccS3Bucket_Basic\|TestAccS3Bucket_disappears -timeout 360m -vet=off
2025/02/27 10:58:13 Initializing Terraform AWS Provider...
=== RUN   TestAccS3Bucket_Basic_basic
=== PAUSE TestAccS3Bucket_Basic_basic
=== RUN   TestAccS3Bucket_Basic_emptyString
=== PAUSE TestAccS3Bucket_Basic_emptyString
=== RUN   TestAccS3Bucket_Basic_nameGenerated
=== PAUSE TestAccS3Bucket_Basic_nameGenerated
=== RUN   TestAccS3Bucket_Basic_namePrefix
=== PAUSE TestAccS3Bucket_Basic_namePrefix
=== RUN   TestAccS3Bucket_Basic_forceDestroy
=== PAUSE TestAccS3Bucket_Basic_forceDestroy
=== RUN   TestAccS3Bucket_Basic_forceDestroyWithUnusualKeyBytes
=== PAUSE TestAccS3Bucket_Basic_forceDestroyWithUnusualKeyBytes
=== RUN   TestAccS3Bucket_Basic_forceDestroyWithObjectVersions
=== PAUSE TestAccS3Bucket_Basic_forceDestroyWithObjectVersions
=== RUN   TestAccS3Bucket_Basic_forceDestroyWithObjectVersionsUnusualKeyBytes
=== PAUSE TestAccS3Bucket_Basic_forceDestroyWithObjectVersionsUnusualKeyBytes
=== RUN   TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes
=== PAUSE TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes
=== RUN   TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled
=== PAUSE TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled
=== RUN   TestAccS3Bucket_Basic_acceleration
=== PAUSE TestAccS3Bucket_Basic_acceleration
=== RUN   TestAccS3Bucket_Basic_keyEnabled
=== PAUSE TestAccS3Bucket_Basic_keyEnabled
=== RUN   TestAccS3Bucket_Basic_requestPayer
=== PAUSE TestAccS3Bucket_Basic_requestPayer
=== RUN   TestAccS3Bucket_disappears
=== PAUSE TestAccS3Bucket_disappears
=== RUN   TestAccS3DirectoryBucket_basic
=== PAUSE TestAccS3DirectoryBucket_basic
=== RUN   TestAccS3DirectoryBucket_disappears
=== PAUSE TestAccS3DirectoryBucket_disappears
=== RUN   TestAccS3DirectoryBucket_forceDestroy
=== PAUSE TestAccS3DirectoryBucket_forceDestroy
=== RUN   TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
=== PAUSE TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
=== RUN   TestAccS3DirectoryBucket_defaultDataRedundancy
=== PAUSE TestAccS3DirectoryBucket_defaultDataRedundancy
=== CONT  TestAccS3Bucket_Basic_basic
=== CONT  TestAccS3Bucket_Basic_acceleration
=== CONT  TestAccS3DirectoryBucket_disappears
--- PASS: TestAccS3DirectoryBucket_disappears (15.11s)
=== CONT  TestAccS3DirectoryBucket_defaultDataRedundancy
--- PASS: TestAccS3Bucket_Basic_basic (18.13s)
=== CONT  TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes
--- PASS: TestAccS3DirectoryBucket_forceDestroyWithUnusualKeyBytes (14.10s)
=== CONT  TestAccS3DirectoryBucket_forceDestroy
--- PASS: TestAccS3DirectoryBucket_defaultDataRedundancy (17.42s)
=== CONT  TestAccS3Bucket_disappears
--- PASS: TestAccS3Bucket_Basic_acceleration (34.48s)
=== CONT  TestAccS3DirectoryBucket_basic
--- PASS: TestAccS3Bucket_disappears (13.04s)
=== CONT  TestAccS3Bucket_Basic_requestPayer
--- PASS: TestAccS3DirectoryBucket_forceDestroy (14.68s)
=== CONT  TestAccS3Bucket_Basic_forceDestroyWithUnusualKeyBytes
--- PASS: TestAccS3DirectoryBucket_basic (17.63s)
=== CONT  TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithUnusualKeyBytes (14.04s)
=== CONT  TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled (18.72s)
=== CONT  TestAccS3Bucket_Basic_forceDestroyWithObjectVersionsUnusualKeyBytes
--- PASS: TestAccS3Bucket_Basic_requestPayer (29.54s)
=== CONT  TestAccS3Bucket_Basic_forceDestroyWithObjectVersions
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes (14.32s)
=== CONT  TestAccS3Bucket_Basic_namePrefix
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithObjectVersionsUnusualKeyBytes (18.28s)
=== CONT  TestAccS3Bucket_Basic_forceDestroy
--- PASS: TestAccS3Bucket_Basic_namePrefix (17.33s)
=== CONT  TestAccS3Bucket_Basic_keyEnabled
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithObjectVersions (18.93s)
=== CONT  TestAccS3Bucket_Basic_nameGenerated
--- PASS: TestAccS3Bucket_Basic_forceDestroy (14.32s)
=== CONT  TestAccS3Bucket_Basic_emptyString
--- PASS: TestAccS3Bucket_Basic_nameGenerated (17.60s)
--- PASS: TestAccS3Bucket_Basic_keyEnabled (19.90s)
--- PASS: TestAccS3Bucket_Basic_emptyString (18.15s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	127.105s

Acceptance test output:

% make testacc TESTARGS='-run=TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy' PKG=s3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/s3/... -v -count 1 -parallel 20  -run=TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy -timeout 360m -vet=off
2025/02/27 11:10:55 Initializing Terraform AWS Provider...
=== RUN   TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy
=== PAUSE TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy
=== CONT  TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy
--- PASS: TestAccS3DirectoryBucket_upgradeDefaultDataRedundancy (51.84s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3	57.463s
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@ewbankkit
Copy link
Contributor

@romsrb Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit affb06d into hashicorp:main Feb 27, 2025
43 checks passed
@github-actions github-actions bot added this to the v5.89.0 milestone Feb 27, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 28, 2025
Copy link

This functionality has been released in v5.89.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

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. enhancement Requests to existing resources that expand the functionality or scope. partner Contribution from a partner. service/s3 Issues and PRs that pertain to the s3 service. 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.

4 participants