Cant create route53 change set for s3 web site

1,533 views
Skip to first unread message

Peter Jones

unread,
Apr 24, 2017, 3:25:45 PM4/24/17
to Terraform
Hi

I have a static web sit ehosted in s3 and Im having trouble scripting the route53 alias record set for this.  I get the error:

aws_route53_record.sitewww: [ERR]: Error building changeset: InvalidChangeBatch: Tried to create an alias that targets my.domain., type A in zone Z3BJ6K6RIION7M, but the alias target name does not lie within the target zone
 status code
: 400, request id: aa6e1511-2921-11e7-9850-a34b9be2d110



My resource.tf file includes the following:

data "aws_route53_zone" "zone" {
name = "${var.domain_name}"
}

resource "aws_route53_record" "siteroot" {
zone_id = "${data.aws_route53_zone.zone.zone_id}"
type = "A"

alias {
zone_id = "${aws_s3_bucket.sitebucket.hosted_zone_id}"
name = "${var.site_bucket_name}."
evaluate_target_health = false
}
}


I think this means the alias.zone_id is wrong but Im not sure what else I can try for that value.

Anyone got any ideas or perhaps a working sample for this?

Thanks

Haydn Dufrene

unread,
Apr 24, 2017, 5:49:31 PM4/24/17
to terrafo...@googlegroups.com
I believe you'll want to use the website domain as the alias name, not the bucket name (https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#website_domain).

something like:
...
name = "${aws_s3_bucket.sitebucket.website_domain}"
...

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/53d37663-28c6-43db-9a74-974042263113%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
CONFIDENTIALITY NOTE

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

Peter Jones

unread,
Apr 24, 2017, 6:49:45 PM4/24/17
to Terraform
Yes, that worked.

Thank you!
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages