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

Fix bucket_regional_domain_name for us-east-1 region #25724

Merged

Conversation

mattbork
Copy link
Contributor

@mattbork mattbork commented Jul 6, 2022

S3 buckets in the us-east-1 region currently always have their bucket_regional_domain_name attribute equal to their (global) bucket_domain_name attribute. This is because BucketRegionalDomainName does not set the S3UsEast1RegionalEndpoint option when calling EndpointFor. This behavior does not directly cause issues with CloudFront DNS routing (the motivation for adding bucket_regional_domain_name) because a legacy global endpoint will go to the us-east-1 region by default. However, it's still counter-intuitive and differs from, for example, the RegionalDomainName attribute in CloudFormation.

I fixed this, updated the relevant acceptance test, and also updated broken links in the documentation for bucket_regional_domain_name.

Community Note

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

Closes #15102.

Output from acceptance testing:

$ export AWS_DEFAULT_REGION=us-east-1
$ make testacc TESTS=TestAccS3Bucket_Basic_basic PKG=s3

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/s3/... -v -count 1 -parallel 20 -run='TestAccS3Bucket_Basic_basic'  -timeout 180m
=== RUN   TestAccS3Bucket_Basic_basic
=== PAUSE TestAccS3Bucket_Basic_basic
=== CONT  TestAccS3Bucket_Basic_basic
--- PASS: TestAccS3Bucket_Basic_basic (26.15s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/s3 26.220s

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/s3 Issues and PRs that pertain to the s3 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jul 6, 2022
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 @mattbork 👋

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 CONTRIBUTING 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 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 7, 2022
@gdavison gdavison self-assigned this Apr 14, 2023
EndpointFor needs the S3UsEast1RegionalEndpoint option set or else it
returns the legacy (global) endpoint for S3 buckets in the us-east-1
region.
Replace broken link to AWS forum thread with relevant section from the
AWS S3 User Guide. Update link to S3 endpoint reference that was moved.
@gdavison gdavison force-pushed the b-aws_s3_bucket-regional_domain_name_fix branch from 5307c19 to 367b8e4 Compare April 15, 2023 00:03
@gdavison gdavison added this to the v5.0.0 milestone Apr 15, 2023
@gdavison gdavison added the breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. label Apr 15, 2023
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @mattbork. We're going to release this as part of v5.0, because it is potentially a breaking change. While the bucket_regional_domain_name seems to work when consumed by other services, there may be unintended effects.

In us-west-2

--- PASS: TestAccS3Bucket_Replication_expectVersioningValidationError (51.11s)
--- PASS: TestAccS3BucketDataSource_basic (70.62s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRuleExpirationEmptyBlock (70.99s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRuleAbortIncompleteMultipartUploadDaysNoExpiration (87.60s)
--- PASS: TestAccS3Bucket_Manage_objectLock_deprecatedEnabled (87.80s)
--- PASS: TestAccS3Bucket_Manage_objectLockWithVersioning_deprecatedEnabled (88.73s)
--- PASS: TestAccS3Bucket_Security_logging (88.50s)
--- PASS: TestAccS3Bucket_Manage_objectLockWithVersioning (90.90s)
--- PASS: TestAccS3Bucket_Replication_withoutPrefix (103.88s)
--- PASS: TestAccS3Bucket_Manage_objectLock_migrate (104.03s)
--- PASS: TestAccS3Bucket_Replication_withoutStorageClass (115.35s)
--- PASS: TestAccS3Bucket_Replication_twoDestination (116.67s)
--- PASS: TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter (116.64s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRemove (127.06s)
--- PASS: TestAccS3Bucket_Manage_lifecycleBasic (133.90s)
--- PASS: TestAccS3Bucket_Manage_lifecycleExpireMarkerOnly (139.12s)
--- PASS: TestAccS3Bucket_Manage_objectLock (144.60s)
--- PASS: TestAccS3Bucket_Duplicate_UsEast1 (41.20s)
--- PASS: TestAccS3Bucket_Duplicate_basic (38.58s)
--- PASS: TestAccS3Bucket_Security_enableDefaultEncryptionWhenAES256IsUsed (88.78s)
--- PASS: TestAccS3Bucket_Security_enableDefaultEncryptionWhenTypical (89.22s)
--- PASS: TestAccS3Bucket_Replication_ruleDestinationAccessControlTranslation (185.79s)
--- PASS: TestAccS3Bucket_disappears (71.44s)
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled (85.90s)
--- PASS: TestAccS3Bucket_Web_routingRules (141.71s)
--- PASS: TestAccS3Bucket_Replication_ruleDestinationAddAccessControlTranslation (208.60s)
--- PASS: TestAccS3Bucket_Basic_keyEnabled (112.36s)
--- PASS: TestAccS3Bucket_Tags_ignoreTags (150.33s)
--- PASS: TestAccS3Bucket_Security_disableDefaultEncryptionWhenDefaultEncryptionIsEnabled (162.71s)
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes (97.75s)
--- PASS: TestAccS3Bucket_Basic_generatedName (110.13s)
--- PASS: TestAccS3Bucket_Tags_basic (116.99s)
--- PASS: TestAccS3Bucket_Basic_forceDestroy (96.34s)
--- PASS: TestAccS3Bucket_Basic_namePrefix (108.23s)
--- PASS: TestAccS3Bucket_Basic_requestPayer (171.01s)
--- PASS: TestAccS3Bucket_Basic_emptyString (103.94s)
--- PASS: TestAccS3Bucket_Manage_versioningAndMFADeleteDisabled (103.76s)
--- PASS: TestAccS3Bucket_Basic_basic (108.39s)
--- PASS: TestAccS3Bucket_Web_redirect (224.09s)
--- PASS: TestAccS3Bucket_Web_simple (227.19s)
--- PASS: TestAccS3Bucket_Basic_acceleration (173.35s)
--- PASS: TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter (126.29s)
--- PASS: TestAccS3Bucket_Security_corsDelete (69.78s)
--- PASS: TestAccS3Bucket_Manage_versioningDisabled (80.98s)
--- PASS: TestAccS3Bucket_Replication_schemaV2SameRegion (86.71s)
--- PASS: TestAccS3Bucket_Manage_MFADeleteDisabled (84.08s)
--- PASS: TestAccS3Bucket_Security_corsSingleMethodAndEmptyOrigin (72.08s)
--- PASS: TestAccS3BucketDataSource_website (60.12s)
--- PASS: TestAccS3Bucket_Security_corsEmptyOrigin (66.29s)
--- PASS: TestAccS3Bucket_Security_corsUpdate (124.51s)
--- PASS: TestAccS3Bucket_Tags_withSystemTags (293.97s)
--- PASS: TestAccS3Bucket_Tags_withNoSystemTags (243.93s)
--- PASS: TestAccS3Bucket_Replication_schemaV2 (385.30s)
--- PASS: TestAccS3Bucket_Manage_versioning (95.05s)
--- PASS: TestAccS3Bucket_Replication_basic (186.52s)
--- PASS: TestAccS3Bucket_Replication_RTC_valid (184.07s)

In us-east-1

--- PASS: TestAccS3Bucket_Replication_expectVersioningValidationError (70.58s)
--- PASS: TestAccS3BucketDataSource_basic (97.43s)
--- PASS: TestAccS3Bucket_Security_corsDelete (98.43s)
--- PASS: TestAccS3Bucket_Security_corsEmptyOrigin (111.34s)
--- PASS: TestAccS3Bucket_Security_corsSingleMethodAndEmptyOrigin (111.36s)
--- PASS: TestAccS3Bucket_Security_enableDefaultEncryptionWhenAES256IsUsed (115.17s)
--- PASS: TestAccS3Bucket_Security_enableDefaultEncryptionWhenTypical (115.56s)
--- PASS: TestAccS3Bucket_Manage_objectLockWithVersioning_deprecatedEnabled (122.89s)
--- PASS: TestAccS3Bucket_Replication_schemaV2SameRegion (123.33s)
--- PASS: TestAccS3Bucket_Security_logging (123.86s)
--- SKIP: TestAccS3Bucket_Duplicate_UsEast1AltAccount (0.02s)
--- PASS: TestAccS3Bucket_Replication_withoutStorageClass (142.54s)
--- PASS: TestAccS3Bucket_Replication_withoutPrefix (147.22s)
--- PASS: TestAccS3Bucket_Web_routingRules (169.18s)
--- PASS: TestAccS3Bucket_Security_disableDefaultEncryptionWhenDefaultEncryptionIsEnabled (170.51s)
--- PASS: TestAccS3Bucket_Security_corsUpdate (174.26s)
--- PASS: TestAccS3Bucket_Manage_versioningAndMFADeleteDisabled (83.70s)
--- PASS: TestAccS3Bucket_Manage_MFADeleteDisabled (83.65s)
--- PASS: TestAccS3Bucket_Replication_twoDestination (108.62s)
--- PASS: TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter (107.06s)
--- PASS: TestAccS3Bucket_Replication_ruleDestinationAddAccessControlTranslation (207.97s)
--- PASS: TestAccS3Bucket_Manage_versioningDisabled (84.39s)
--- PASS: TestAccS3Bucket_Manage_objectLockWithVersioning (85.67s)
--- PASS: TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter (105.49s)
--- PASS: TestAccS3Bucket_Web_redirect (219.14s)
--- PASS: TestAccS3Bucket_Manage_objectLock_deprecatedEnabled (77.93s)
--- SKIP: TestAccS3Bucket_Duplicate_basic (0.00s)
--- PASS: TestAccS3Bucket_Web_simple (223.95s)
--- PASS: TestAccS3Bucket_Manage_objectLock_migrate (94.99s)
--- PASS: TestAccS3Bucket_Replication_ruleDestinationAccessControlTranslation (173.14s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRuleAbortIncompleteMultipartUploadDaysNoExpiration (70.09s)
--- PASS: TestAccS3Bucket_Duplicate_UsEast1 (32.47s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRuleExpirationEmptyBlock (53.65s)
--- PASS: TestAccS3Bucket_disappears (38.21s)
--- PASS: TestAccS3Bucket_Manage_versioning (142.27s)
--- PASS: TestAccS3Bucket_Manage_lifecycleRemove (97.20s)
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithObjectLockEnabled (57.51s)
--- PASS: TestAccS3Bucket_Tags_basic (67.61s)
--- PASS: TestAccS3Bucket_Manage_objectLock (114.28s)
--- PASS: TestAccS3Bucket_Replication_RTC_valid (285.35s)
--- PASS: TestAccS3Bucket_Replication_basic (178.45s)
--- PASS: TestAccS3Bucket_Manage_lifecycleExpireMarkerOnly (93.77s)
--- PASS: TestAccS3Bucket_Tags_ignoreTags (88.20s)
--- PASS: TestAccS3Bucket_Basic_keyEnabled (57.46s)
--- PASS: TestAccS3Bucket_Basic_generatedName (49.64s)
--- PASS: TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes (43.08s)
--- PASS: TestAccS3Bucket_Basic_forceDestroy (42.51s)
--- PASS: TestAccS3Bucket_Manage_lifecycleBasic (91.15s)
--- PASS: TestAccS3Bucket_Basic_namePrefix (39.00s)
--- PASS: TestAccS3Bucket_Basic_requestPayer (79.34s)
--- PASS: TestAccS3Bucket_Basic_basic (38.50s)
--- PASS: TestAccS3BucketDataSource_website (33.06s)
--- PASS: TestAccS3Bucket_Basic_emptyString (38.07s)
--- PASS: TestAccS3Bucket_Replication_schemaV2 (312.50s)
--- PASS: TestAccS3Bucket_Basic_acceleration (70.94s)
--- PASS: TestAccS3Bucket_Tags_withNoSystemTags (128.66s)
--- PASS: TestAccS3Bucket_Tags_withSystemTags (153.89s)

@gdavison gdavison merged commit f6a0967 into hashicorp:main May 24, 2023
@github-actions
Copy link

This functionality has been released in v5.0.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!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/s3 Issues and PRs that pertain to the s3 service. size/XS Managed by automation to categorize the size of a PR. 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.

bucket_regional_domain_name does not contain the region
3 participants