Skip to content

Instantly share code, notes, and snippets.

@brunodasilvalenga
Created May 4, 2020 23:22
Show Gist options
  • Save brunodasilvalenga/e5bb9a5e88aac0bc4aa0dc2941f40992 to your computer and use it in GitHub Desktop.
Save brunodasilvalenga/e5bb9a5e88aac0bc4aa0dc2941f40992 to your computer and use it in GitHub Desktop.
resource "aws_api_gateway_domain_name" "services_gateway" {
domain_name = "${local.workspace["services_gateway_hostname"]}"
regional_certificate_arn = "${data.aws_acm_certificate.domain_host.arn}"
endpoint_configuration {
types = ["REGIONAL"]
}
}
data "aws_route53_zone" "services_selected" {
name = "${local.workspace["services_gateway_hosted_zone"]}"
}
resource "aws_route53_record" "services_hostname" {
count = local.workspace["services_gateway_create_domain"] ? 1 : 0
name = "${aws_api_gateway_domain_name.services_gateway.domain_name}"
type = "A"
zone_id = "${data.aws_route53_zone.services_selected.zone_id}"
alias {
evaluate_target_health = true
name = "${aws_api_gateway_domain_name.services_gateway.regional_domain_name}"
zone_id = "${aws_api_gateway_domain_name.services_gateway.regional_zone_id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment