Skip to content

Commit

Permalink
feat(infrastructure): provision ECS infra
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-h1 committed Feb 22, 2024
1 parent 9e88485 commit d8461da
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions terraform/module/acm.tf
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# resource "aws_acm_certificate" "domain" {
# domain_name = var.domain
# validation_method = "DNS"
# tags = merge(var.tags, {
# "Name" = "${var.project_name}-${var.environment}-certificate"
# "Description" = "Certificate for ${var.project_name}-${var.environment}"
# })
resource "aws_acm_certificate" "domain" {
domain_name = "lhowsam.com"
validation_method = "DNS"
tags = merge(var.tags, {
"Name" = "${var.project_name}-${var.environment}-certificate"
"Description" = "Certificate for ${var.project_name}-${var.environment}"
})

# lifecycle {
# create_before_destroy = true
lifecycle {
create_before_destroy = true

# # only set to false because we might need to do a full teardown
# prevent_destroy = false
# }
# }
# only set to false because we might need to do a full teardown
prevent_destroy = false
}
}

# data "aws_route53_zone" "domain" {
# name = var.domain
# private_zone = false
# tags = merge(var.tags, {
# "Name" = "${var.project_name}-${var.environment}-route53-zone"
# "Description" = "Route53 zone for ${var.project_name}-${var.environment}"
# })
# }
data "aws_route53_zone" "domain" {
name = "lhowsam.com"
private_zone = false
tags = merge(var.tags, {
"Name" = "${var.project_name}-${var.environment}-route53-zone"
"Description" = "Route53 zone for ${var.project_name}-${var.environment}"
})
}

# resource "aws_route53_record" "domain" {
# for_each = {
# for dvo in aws_acm_certificate.domain.domain_validation_options : dvo.domain_name => {
# name = dvo.resource_record_name
# record = dvo.resource_record_value
# type = dvo.resource_record_type
# }
# }
resource "aws_route53_record" "domain" {
for_each = {
for dvo in aws_acm_certificate.domain.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
}
}

# allow_overwrite = true
# name = each.value.name
# records = [each.value.record]
# ttl = 60
# type = each.value.type
# zone_id = data.aws_route53_zone.domain.zone_id
# }
allow_overwrite = true
name = each.value.name
records = [each.value.record]
ttl = 60
type = each.value.type
zone_id = data.aws_route53_zone.domain.zone_id
}

# resource "aws_acm_certificate_validation" "domain" {
# certificate_arn = aws_acm_certificate.domain.arn
# validation_record_fqdns = [for record in aws_route53_record.domain : record.fqdn]
# }
resource "aws_acm_certificate_validation" "domain" {
certificate_arn = aws_acm_certificate.domain.arn
validation_record_fqdns = [for record in aws_route53_record.domain : record.fqdn]
}

0 comments on commit d8461da

Please sign in to comment.