Skip to content

Commit 114d94e

Browse files
committed
fix: loop through acm certificate records with inline map for implicit dependency
1 parent 76581b7 commit 114d94e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

modules/acm/main.tf

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
locals {
2-
acm_certificate_validation_records = [
3-
for record in aws_acm_certificate.this.domain_validation_options :
4-
{
5-
name = record.resource_record_name
6-
type = record.resource_record_type
7-
value = record.resource_record_value
8-
domain = record.domain_name
9-
}
10-
]
11-
}
12-
131
################################################################################
142
# ACM Certificate
153
################################################################################
@@ -41,16 +29,20 @@ resource "aws_acm_certificate" "this" {
4129
################################################################################
4230

4331
resource "aws_route53_record" "this" {
44-
for_each = local.acm_certificate_validation_records
32+
for_each = {
33+
for record in aws_acm_certificate.this.domain_validation_options : record.domain_name => {
34+
name = record.resource_record_name
35+
type = record.resource_record_type
36+
value = record.resource_record_value
37+
}
38+
}
4539

4640
zone_id = var.record_zone_id
4741
name = each.value.name
4842
type = each.value.type
4943
records = [each.value.value]
5044
ttl = 60
5145
allow_overwrite = var.record_allow_overwrite
52-
53-
depends_on = [aws_acm_certificate.this]
5446
}
5547

5648
resource "aws_acm_certificate_validation" "this" {

0 commit comments

Comments
 (0)