Skip to content

Instantly share code, notes, and snippets.

@l1x
Created April 10, 2022 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save l1x/1f8423935072b8a5427406dd68e0cf3f to your computer and use it in GitHub Desktop.
Save l1x/1f8423935072b8a5427406dd68e0cf3f to your computer and use it in GitHub Desktop.
Creating an AWS Apigateway HTTP API with custom domain
resource "aws_apigatewayv2_domain_name" "api-gw-domain-name" {
domain_name = var.domain-name
domain_name_configuration {
certificate_arn = var.acm-certificate-arn
endpoint_type = "REGIONAL"
security_policy = "TLS_1_2"
}
}
resource "aws_route53_record" "dns-alias" {
zone_id = var.dns-zone-id
name = var.domain-name
type = "A"
alias {
name = aws_apigatewayv2_domain_name.api-gw-domain-name.domain_name_configuration[0].target_domain_name
zone_id = aws_apigatewayv2_domain_name.api-gw-domain-name.domain_name_configuration[0].hosted_zone_id
evaluate_target_health = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment