-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infrastructure): provision ECS infra
- Loading branch information
Showing
1 changed file
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
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] | ||
} |