I've created an elastic beanstalk environment through terraform. I'd like to add a route53 record pointing at the load balancer's dns but I can't figure out how to get the full url from the outputs of the EB environment.
The aws_elastic_beanstalk_environment.xxx.load_balancers property contains the name but not the FQDN.
Once you have created both beanstalk resources like so
resource "aws_elastic_beanstalk_application" "eb_app" {
name = "eb_app"
description = "some description"
}
resource "aws_elastic_beanstalk_environment" "eb_env" {
name = "eb_env"
application = "${aws_elastic_beanstalk_application.eb_app.name}"
solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
setting {
namespace = "aws:ec2:vpc"
name = "VPCId"
value = "something"
}
setting {
namespace = "aws:ec2:vpc"
name = "Subnets"
value = "somethingelse"
}
}
The documentation included here specifies that you can use 'cname' to output the fully qualified DNS name for the environment
To do that you would write something like
output "cname" {
value = "${aws_elastic_beanstalk_environment.eb_env.cname}"
}
Then, in the same directory that you invoked the module, you could
cname_to_pass_to_route53 = "${module.some_eb_module.cname}"
If the cname is not the exact verision of the url that you need, you could append or prepend the variable name when passing it in. It does say fully qualified DNS name though, so I don't think you'd need to do that.
cname_to_pass_to_route53 = "maybeHere://${module.some_eb_module.cname}/orOverHere"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With