belt 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/belt/version.rb +1 -1
- data/lib/templates/module/dns.tf.erb +30 -18
- data/lib/templates/module/main.tf.erb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05d5db875d229ad413bf8af05004a92961776b347db0884ded768f35fcfe245e
|
|
4
|
+
data.tar.gz: d6f1590f52f2a04b9457b82cf0c0cad094b96b8e04e112672df37d1e5ccf173b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b9c29157f8d7b698c8f68c807564299f881b220473ef4a51194352092f5a8967dfce0495fb12bc24a813b4ab2e077358c3800151ccf8737059888560a62ad97
|
|
7
|
+
data.tar.gz: 6629a4a02a92e571d1e835ba0f12894f8bad945eb89bf79a2bc4696538378f45dfd7b5f5e3fc4090d9e61120c51d032b2fab5d5e2bdc17cfdfe81d25950061db
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.2
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **First deploy of a new env with a `domain` no longer fails at plan.** The generated
|
|
8
|
+
module keyed `aws_route53_record.cert_validation` by the ACM validation CNAME name,
|
|
9
|
+
which is unknown until the cert exists, so `belt plan`/`belt deploy` on a brand-new
|
|
10
|
+
standalone env failed with `Invalid for_each argument` and needed a `-target` apply
|
|
11
|
+
of the cert first. The record is now `aws_route53_record.acm_validation`, keyed by
|
|
12
|
+
the env's domain (known at plan). A `removed` block forgets old `cert_validation`
|
|
13
|
+
instances without deleting the live CNAME. The module now needs Terraform >= 1.7.
|
|
14
|
+
Existing apps: see [UPGRADING.md](UPGRADING.md#acm-validation-record-062).
|
|
15
|
+
|
|
3
16
|
## 0.6.1
|
|
4
17
|
|
|
5
18
|
### Fixed
|
data/lib/belt/version.rb
CHANGED
|
@@ -62,33 +62,45 @@ resource "aws_acm_certificate" "app" {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
# DNS validation record for the certificate
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
resource "aws_route53_record" "
|
|
72
|
-
for_each = local.dns_enabled && !local.is_nested ?
|
|
73
|
-
for dvo in aws_acm_certificate.app[0].domain_validation_options : dvo.resource_record_name => {
|
|
74
|
-
name = dvo.resource_record_name
|
|
75
|
-
type = dvo.resource_record_type
|
|
76
|
-
record = dvo.resource_record_value
|
|
77
|
-
}...
|
|
78
|
-
} : {}
|
|
65
|
+
# DNS validation record for the certificate.
|
|
66
|
+
# ACM issues one identical validation CNAME for both the base domain and the
|
|
67
|
+
# wildcard, so one record covers the cert. Key it by app_domain (known at plan)
|
|
68
|
+
# rather than by anything from domain_validation_options: those values are
|
|
69
|
+
# unknown until the cert exists, and for_each over them fails the first plan
|
|
70
|
+
# of a new env with "Invalid for_each argument".
|
|
71
|
+
resource "aws_route53_record" "acm_validation" {
|
|
72
|
+
for_each = local.dns_enabled && !local.is_nested ? toset([local.app_domain]) : toset([])
|
|
79
73
|
|
|
80
74
|
zone_id = aws_route53_zone.app[0].zone_id
|
|
81
|
-
name = each.
|
|
82
|
-
type = each.
|
|
75
|
+
name = local.acm_validation_options[each.key].resource_record_name
|
|
76
|
+
type = local.acm_validation_options[each.key].resource_record_type
|
|
83
77
|
ttl = 300
|
|
84
|
-
records = [each.
|
|
78
|
+
records = [local.acm_validation_options[each.key].resource_record_value]
|
|
85
79
|
allow_overwrite = true
|
|
86
80
|
}
|
|
87
81
|
|
|
82
|
+
locals {
|
|
83
|
+
acm_validation_options = local.dns_enabled && !local.is_nested ? {
|
|
84
|
+
for dvo in aws_acm_certificate.app[0].domain_validation_options : dvo.domain_name => dvo
|
|
85
|
+
} : {}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Older Belt modules created this record as cert_validation, keyed by the
|
|
89
|
+
# validation CNAME name. Forget those instances without deleting them:
|
|
90
|
+
# acm_validation upserts the same CNAME (allow_overwrite), and a delete would
|
|
91
|
+
# pull the record ACM needs for renewal. No-op for envs that never had it.
|
|
92
|
+
removed {
|
|
93
|
+
from = aws_route53_record.cert_validation
|
|
94
|
+
|
|
95
|
+
lifecycle {
|
|
96
|
+
destroy = false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
resource "aws_acm_certificate_validation" "app" {
|
|
89
101
|
count = local.dns_enabled && !local.is_nested ? 1 : 0
|
|
90
102
|
certificate_arn = aws_acm_certificate.app[0].arn
|
|
91
|
-
validation_record_fqdns = [for record in aws_route53_record.
|
|
103
|
+
validation_record_fqdns = [for record in aws_route53_record.acm_validation : record.fqdn]
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
# =============================================================================
|