Skip to content

Instantly share code, notes, and snippets.

@estenssoros
Last active September 20, 2023 07:38
Show Gist options
  • Save estenssoros/1ea6b59ff6d61af4f2c4b53662092591 to your computer and use it in GitHub Desktop.
Save estenssoros/1ea6b59ff6d61af4f2c4b53662092591 to your computer and use it in GitHub Desktop.
Docker, ECR, Elastic Beanstalk, & Terraform route53.tf
locals {
api_name = var.environment == "prod" ? "api" : "api-${var.environment}"
}
module "certificate" {
source = "../certificates"
domain_name = "${local.api_name}.${var.domain_name}"
route53_zone_name = var.route53_zone_name
region = "us-west-2"
}
data "aws_route53_zone" "hosted_zone" {
name = var.route53_zone_name
}
resource "aws_route53_record" "lb" {
zone_id = data.aws_route53_zone.hosted_zone.zone_id
name = "${local.api_name}.${var.domain_name}"
type = "CNAME"
ttl = 5
records = [aws_elastic_beanstalk_environment.env[0].cname]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment