66 lines
1.7 KiB
HCL
66 lines
1.7 KiB
HCL
# provider "aws" {
|
|
# alias = "cert"
|
|
# region = "us-east-1"
|
|
# }
|
|
#
|
|
# resource "aws_acm_certificate" "cert" {
|
|
# provider = aws.cert
|
|
# domain_name = local.app_domain_name
|
|
# validation_method = "DNS"
|
|
#
|
|
# subject_alternative_names = [local.api_domain_name]
|
|
#
|
|
# tags = {
|
|
# Environment = var.environment
|
|
# }
|
|
#
|
|
# lifecycle {
|
|
# create_before_destroy = true
|
|
# }
|
|
# }
|
|
#
|
|
# resource "aws_route53_record" "cert_validation" {
|
|
# for_each {
|
|
# for dvo in aws_acm_certificate.cert.domain_validation_options : dvo.domain_name => {
|
|
# name = dvo.resource_record_name
|
|
# type = dvo.resource_record_type
|
|
# record = dvo.resource_record_value
|
|
# }
|
|
# }
|
|
#
|
|
# allow_overwrite = true
|
|
# name = each.value.name
|
|
# records = [ each.value.record ]
|
|
# ttl = 60
|
|
# type = each.value.type
|
|
# zone_id = var.route53_zone.zone_id
|
|
# }
|
|
#
|
|
# resource "aws_acm_certificate_validation" "cert" {
|
|
# provider = aws.cert
|
|
# certificate_arn = aws_acm_certificate.cert.arn
|
|
# validation_record_fqdns = [ for record in aws_route53_record.cert_validation : record.fqdn ]
|
|
# }
|
|
|
|
resource "aws_route53_record" "app_domain" {
|
|
zone_id = var.route53_zone.zone_id
|
|
name = local.app_domain_name
|
|
type = "A"
|
|
|
|
alias {
|
|
name = aws_cloudfront_distribution.s3_distribution.domain_name
|
|
zone_id = aws_cloudfront_distribution.s3_distribution.hosted_zone_id
|
|
evaluate_target_health = false
|
|
}
|
|
|
|
depends_on = [aws_cloudfront_distribution.s3_distribution ]
|
|
}
|
|
|
|
# resource "aws_route53_record" "api_domain" {
|
|
# zone_id = var.route53_zone.zone_id
|
|
# name = local.api_domain_name
|
|
# type = "A"
|
|
#
|
|
# # TODO: alias configuration
|
|
# }
|