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

cloudfront.hosted_zone_id is wrong in China #15223

Closed
romaninsh opened this issue Sep 18, 2020 · 5 comments · Fixed by #21943
Closed

cloudfront.hosted_zone_id is wrong in China #15223

romaninsh opened this issue Sep 18, 2020 · 5 comments · Fixed by #21943
Labels
bug Addresses a defect in current functionality. service/cloudfront Issues and PRs that pertain to the cloudfront service.
Milestone

Comments

@romaninsh
Copy link

  zone_id = aws_cloudfront_distribution.web_distribution.hosted_zone_id

When using hosted_zone_id of aws_cloudfront_distribution it returns a hardcoded value of Z2FDTNDATAQYW2. This value is different for AWS in China and should be Z3RFFRIM2A3IF5 instead.

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 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.2
+ provider registry.terraform.io/hashicorp/aws v3.7.0

Affected Resource(s)

  • aws_cloudfront_distribution

Terraform Configuration Files

resource "aws_cloudfront_distribution" "web_distribution" {
  enabled             = true
  is_ipv6_enabled     = false
  aliases             = ["static.${var.domain}"]
  default_root_object = "index.html"

  origin {
    domain_name = data.aws_s3_bucket.components_bucket.bucket_regional_domain_name
    origin_id   = "S3"
  }

  viewer_certificate {
    iam_certificate_id =  aws_iam_server_certificate.cert.id
    ssl_support_method  = "sni-only"
  }

  default_cache_behavior {
    allowed_methods  = ["GET", "HEAD"]
    cached_methods   = ["GET", "HEAD"]
    target_origin_id = "S3"

    forwarded_values {
      query_string = false

      cookies {
        forward = "none"
      }
    }

    viewer_protocol_policy = "redirect-to-https"
  }

  restrictions {
    geo_restriction {
      restriction_type = "none"
    }
  }

  tags = {
    CreatedBy = "terraform ssl-init"
  }
}

output "zone_id" {
  value = aws_cloudfront_distribution.web_distribution.domain_name
}

References

I believe assumption is coming from:
https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/cloudfront_distribution_configuration_structure.go#L24

@ghost ghost added the service/cloudfront Issues and PRs that pertain to the cloudfront service. label Sep 18, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 18, 2020
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Sep 18, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 18, 2020

When creating alias records programmatically and routing traffic to an Amazon CloudFront distribution, use the following hosted zone ID: Z3RFFRIM2A3IF5.

Related docs: https://docs.amazonaws.cn/en_us/aws/latest/userguide/route53.html

@anGie44 anGie44 added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 18, 2020
@mgzenitech
Copy link

this isn't an enhancement, this is a bug 💯 %

@anGie44 anGie44 added bug Addresses a defect in current functionality. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Mar 18, 2021
@anGie44
Copy link
Contributor

anGie44 commented Mar 18, 2021

nice catch @mgzenitech ! updated 👍

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

This functionality has been released in v3.68.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 issue 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 similar to this, 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 May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/cloudfront Issues and PRs that pertain to the cloudfront service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants