Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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