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

Add s3 domain names with region so cloudfront origins outside of us-east-1 won't cause redirects immediately after setup #4540

Closed
kitsunde opened this issue May 15, 2018 · 4 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@kitsunde
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Buckets created outside of us-east-1 will redirect to s3 when set as origins for cloudfront until DNS propagation has happened unless using the regional domain name. We need to set:

${aws_s3_bucket.default.bucket}.s3-${aws_s3_bucket.default.region}.amazonaws.com

It would be nice if we could get a regional_domain_name or maybe canonical_domain_name from the aws_s3_bucket resource, and even make it recommended for origin since it's rather surprising especially if the redirects get cached.

New or Affected Resource(s)`

  • aws_s3_bucket

Potential Terraform Configuration

This

  origin {
    domain_name = "${aws_s3_bucket.default.domain_name}"
    origin_id = "s3-${var.environment}"
    s3_origin_config {
      origin_access_identity = "${aws_cloudfront_origin_access_identity.default.cloudfront_access_identity_path}"
    }
  }

Needs to be rewritten as:

  origin {
    domain_name = "${aws_s3_bucket.default.bucket}.s3-${aws_s3_bucket.default.region}.amazonaws.com"
    origin_id = "s3-${var.environment}"
    s3_origin_config {
      origin_access_identity = "${aws_cloudfront_origin_access_identity.default.cloudfront_access_identity_path}"
    }
  }

References

@bill-rich bill-rich added the enhancement Requests to existing resources that expand the functionality or scope. label May 15, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 16, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 16, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 16, 2018
@saravanan30erd
Copy link
Contributor

PR submitted: #4556

@bflad bflad added the service/s3 Issues and PRs that pertain to the s3 service. label May 18, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 24, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 25, 2018
saravanan30erd added a commit to saravanan30erd/terraform-provider-aws that referenced this issue May 25, 2018
reverting changes due to conflict
@bflad bflad added this to the v1.21.0 milestone May 30, 2018
@bflad
Copy link
Contributor

bflad commented May 30, 2018

The bucket_regional_domain_name attribute will be available in the aws_s3_bucket resource in version 1.21.0 of the AWS provider, releasing later today.

@bflad bflad closed this as completed May 30, 2018
@bflad
Copy link
Contributor

bflad commented May 31, 2018

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

bflad added a commit that referenced this issue Mar 17, 2019
…s to match PR #7202 changes

Also switches example references from `aws_s3_bucket.X.bucket_domain_name` to `aws_s3_bucket.X.bucket_regional_domain_name` to match the acceptance testing and prevent issues like #4540
@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

4 participants