feat(dns): simplify PROD Route 53 by using prod-sacc.ccsoft.mx directly
Switch PROD DNS from cross-account Route 53 management to a delegated subdomain in the PROD AWS account (523761210517). Changes: - prod.tfvars: domain_name changed to prod-sacc.ccsoft.mx - provider.tf: removed aws.route53 cross-account provider - main.tf: removed prod-specific Route 53 resources and data sources; cert_validation and main records now use default provider for all envs - outputs.tf: removed indexed references to main_prod resource
This commit is contained in:
+2
-46
@@ -445,18 +445,6 @@ resource "aws_acm_certificate" "main" {
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "cert_validation" {
|
||||
count = var.environment != "prod" ? 1 : 0
|
||||
allow_overwrite = true
|
||||
name = tolist(aws_acm_certificate.main.domain_validation_options)[0].resource_record_name
|
||||
records = [tolist(aws_acm_certificate.main.domain_validation_options)[0].resource_record_value]
|
||||
ttl = 60
|
||||
type = tolist(aws_acm_certificate.main.domain_validation_options)[0].resource_record_type
|
||||
zone_id = local.route53_zone_id
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "cert_validation_prod" {
|
||||
provider = aws.route53
|
||||
count = var.environment == "prod" ? 1 : 0
|
||||
allow_overwrite = true
|
||||
name = tolist(aws_acm_certificate.main.domain_validation_options)[0].resource_record_name
|
||||
records = [tolist(aws_acm_certificate.main.domain_validation_options)[0].resource_record_value]
|
||||
@@ -468,40 +456,22 @@ resource "aws_route53_record" "cert_validation_prod" {
|
||||
resource "aws_acm_certificate_validation" "main" {
|
||||
provider = aws.us_east_1
|
||||
certificate_arn = aws_acm_certificate.main.arn
|
||||
validation_record_fqdns = local.cert_validation_fqdns
|
||||
validation_record_fqdns = [aws_route53_record.cert_validation.fqdn]
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------------
|
||||
# Route 53
|
||||
# -------------------------------------------------------------------------------
|
||||
data "aws_route53_zone" "main" {
|
||||
count = var.environment != "prod" ? 1 : 0
|
||||
name = var.domain_name
|
||||
private_zone = false
|
||||
}
|
||||
|
||||
data "aws_route53_zone" "main_prod" {
|
||||
provider = aws.route53
|
||||
count = var.environment == "prod" ? 1 : 0
|
||||
name = var.domain_name
|
||||
private_zone = false
|
||||
}
|
||||
|
||||
locals {
|
||||
route53_zone_id = coalesce(
|
||||
try(data.aws_route53_zone.main[0].zone_id, ""),
|
||||
try(data.aws_route53_zone.main_prod[0].zone_id, "")
|
||||
)
|
||||
|
||||
cert_validation_fqdns = compact(try(
|
||||
[aws_route53_record.cert_validation[0].fqdn],
|
||||
[aws_route53_record.cert_validation_prod[0].fqdn],
|
||||
[]
|
||||
))
|
||||
route53_zone_id = data.aws_route53_zone.main.zone_id
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "main" {
|
||||
count = var.environment != "prod" ? 1 : 0
|
||||
zone_id = local.route53_zone_id
|
||||
name = var.domain_name
|
||||
type = "A"
|
||||
@@ -513,20 +483,6 @@ resource "aws_route53_record" "main" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "main_prod" {
|
||||
provider = aws.route53
|
||||
count = var.environment == "prod" ? 1 : 0
|
||||
zone_id = local.route53_zone_id
|
||||
name = var.domain_name
|
||||
type = "A"
|
||||
|
||||
alias {
|
||||
name = aws_cloudfront_distribution.main.domain_name
|
||||
zone_id = aws_cloudfront_distribution.main.hosted_zone_id
|
||||
evaluate_target_health = false
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------------
|
||||
# CloudFront Distribution
|
||||
# -------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user