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

Possible Bug in aws/s3_bucket provider populating the hosted_zone_id attribute #3334

Closed
code-later opened this issue Sep 27, 2015 · 8 comments · Fixed by #4236
Closed

Possible Bug in aws/s3_bucket provider populating the hosted_zone_id attribute #3334

code-later opened this issue Sep 27, 2015 · 8 comments · Fixed by #4236

Comments

@code-later
Copy link

I want to create a S3 bucket enabled for 'Static Website Hosting' and creating a Route53 alias record for it. This is the part of my config to do so:

resource "aws_s3_bucket" "styleguide" {
  bucket = "styleguide.staging.fejo.sexy"
  acl = "public-read"

  website {
    index_document = "index.html"
    error_document = "error.html"
  }
}

resource "aws_route53_record" "styleguide" {
  zone_id = "${var.route53_fejo_sexy_zone_id}"
  name = "styleguide.staging.fejo.sexy"
  type = "A"

  alias {
    name = "${aws_s3_bucket.styleguide.website_domain}"
    zone_id = "${aws_s3_bucket.styleguide.hosted_zone_id}"
    evaluate_target_health = true
  }
}

Creating the bucket works as expected but the Route53 record resource fails with the following error (Searching for this didn't yielded any results so far):

aws_route53_record.styleguide: InvalidChangeBatch: amazon.security.AmzUidException: Encrypted token cannot be empty

It seems the aws_s3_bucketdoesn't return any value for hosted_zone_id. I added the attribute to the output my config and it was empty. Finally adding the zone_id manually to the Terraform config made everything work. But obviously this is not what I wanted ;-)

I already found the issue #2210 which seemed to relate to this overall topic. I guess someone already tested this while working on the issue. Thus I don't know if I made something wrong in my config or if this is a real bug.

Thanks for helping out!

@AlexanderEkdahl
Copy link
Contributor

Are you by any chance using eu-central-1 region? I've encountered the same error.

@code-later
Copy link
Author

Yes. I'm running in eu-central-1. sirry to mention this before.

On 23.10.2015, at 22:58, Alexander Ekdahl [email protected] wrote:

Are you by any chance using eu-central-1 region? I've encountered the same error.


Reply to this email directly or view it on GitHub.

@catsby
Copy link
Contributor

catsby commented Nov 30, 2015

Hey @railsbros-dirk – sorry for the silence here. I believe this issue is fixed now, as I'm not able to reproduce it. The fix should have been introduced in 0.6.2, so if you're still hitting this let me know.

I used this config to test, and things worked as expected:

resource "aws_s3_bucket" "styleguide" {
  bucket = "styleguide.staging.tftesting.com"
  acl    = "public-read"

  website {
    index_document = "index.html"
    error_document = "error.html"
  }
}

resource "aws_route53_zone" "primary" {
  name = "tftesting.com"
}

resource "aws_route53_record" "styleguide" {
  zone_id = "${aws_route53_zone.primary.id}"
  name    = "styleguide.staging.tftesting.com"
  type    = "A"

  alias {
    name                   = "${aws_s3_bucket.styleguide.website_domain}"
    zone_id                = "${aws_s3_bucket.styleguide.hosted_zone_id}"
    evaluate_target_health = true
  }
}

output "hosted" {
  value = "${aws_s3_bucket.styleguide.hosted_zone_id}"
}

@catsby catsby closed this as completed Nov 30, 2015
@code-later
Copy link
Author

Sorry, only had the chance to test this today. I still don't get a hosted_zone_id:

~ module.styleguide.aws_route53_record.styleguide
    alias.1470388263.evaluate_target_health: "1" => "0"
    alias.1470388263.name:                   "s3-website.eu-central-1.amazonaws.com" => ""
    alias.1470388263.zone_id:                "Z21DNDUVLTQW6Q" => ""
    alias.909221137.evaluate_target_health:  "" => "1"
    alias.909221137.name:                    "" => "s3-website.eu-central-1.amazonaws.com"
    alias.909221137.zone_id:                 "" => ""

My config is the same as yours. What region do tested this in? I'm running in eu-central-1, maybe there is a problem with this..

@catsby
Copy link
Contributor

catsby commented Dec 9, 2015

Yep, found it, patch incoming..

@catsby
Copy link
Contributor

catsby commented Dec 9, 2015

Fix sent in #4236 , turns out we have a typo 😦

@code-later
Copy link
Author

Thanks for the fast fix. And damn those typos😊

On 09.12.2015, at 17:45, Clint [email protected] wrote:

Fix sent in #4236 , turns out we have a typo


Reply to this email directly or view it on GitHub.

@ghost
Copy link

ghost commented Apr 29, 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 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.

@ghost ghost locked and limited conversation to collaborators Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants