-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Export Elastic Beanstalk's Zone ID for Route 53 Alias record #7071
Comments
@apavamontri There is no zone id of elastic beanstalk afaik, you have to use cname only. |
@apavamontri There are dedicated zone id's per region for Elastic Beanstalk. I'm not sure if it makes sense to export this as a part of the resource. http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region |
@dharrisio Ahhh.. I shall use that in the default variable and try to that in Route 53 then. Thank you! |
Ran into this issue today, thanks for the help @dharrisio and @apavamontri ! Edit: Just use No need to do this anymore. variable "aws_elasticbeanstalk_zones" {
# https://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region
# Correct @ 30/04/18
type = "map"
default {
"us-east-2" = "Z14LCN19Q5QHIC"
"us-east-1" = "Z117KPS5GTRQ2G"
"us-west-1" = "Z1LQECGX5PH1X"
"us-west-2" = "Z38NKT9BP95V3O"
"ca-central-1" = "ZJFCZL7SSZB5I"
"ap-south-1" = "Z18NTBI3Y7N9TZ"
"ap-northeast-2" = "Z3JE5OI70TWKCP"
"ap-northeast-3" = "ZNE5GEY1TIAGY"
"ap-southeast-1" = "Z16FZ9L249IFLT"
"ap-southeast-2" = "Z2PCDNR3VC2G1N"
"ap-northeast-1" = "Z1R25G3KIG2GBW"
"eu-central-1" = "Z1FRNW7UH4DEZJ"
"eu-west-1" = "Z2NYPWQ7DFZAZH"
"eu-west-2" = "Z1GKAAAUGATPF1"
"eu-west-3" = "Z5WN6GAYWG5OB"
"sa-east-1" = "Z10X7K2B4QSOFV"
}
}
# example use:
resource "aws_route53_record" "my_domain" {
zone_id = "${data.aws_route53_zone.my_domain.zone_id}"
name = "subdomain.${data.aws_route53_zone.my_domain.name}"
type = "A"
alias {
name = "${aws_elastic_beanstalk_environment.my_elastic_beanstalk.cname}"
zone_id = "${var.aws_elasticbeanstalk_zones["eu-west-2"]}"
evaluate_target_health = false
}
}
data "aws_route53_zone" "my_domain" {
name = "example.com"
} |
There is also a data source available for this: data "aws_elastic_beanstalk_hosted_zone" "current" {}
output "eb_hosted_zone_id" {
value = "${data.aws_elastic_beanstalk_hosted_zone.current.id}"
} This was previously released in version 1.9.0 of the AWS provider and has been available in all releases since. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
thanks a lot to @bflad I used successfully your piece of code in this way
|
Glad it worked! I'm going to lock this thread to encourage any new bug reports/enhancements surrounding this to be submitted into the AWS provider repository. 👍 |
I am trying to associate the Elastic Beanstalk with Route 53 using Alias record. However the
zone_id
of Elastic Beanastalk is not available. My current work around is to useCNAME
and point to Elastic beanstalkcname
attribute instead.Terraform Version
Terraform v0.6.16
Affected Resource(s)
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
N/A
Debug Output
N/A
Panic Output
N/A
Expected Behavior
Export zone_id attribute so it can be used with Route 53 Alias record
Actual Behavior
No zone_id attribute
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Error Message
Important Factoids
N/A
References
N/A
The text was updated successfully, but these errors were encountered: