Created
April 10, 2022 17:08
-
-
Save l1x/1f8423935072b8a5427406dd68e0cf3f to your computer and use it in GitHub Desktop.
Creating an AWS Apigateway HTTP API with custom domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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