Skip to content

Commit

Permalink
ACM certificate route53 overwrite (#99)
Browse files Browse the repository at this point in the history
[fix] ACM certificate route53 validation overwrite### Summary
The new tf provider refuses to overwrite existing route53 records breaking previous functionality. This is a problem for acm since we need the same record for each region. Therefore, we allow route53 records to be overwritten by default.

### Test Plan
unittests

### References
hashicorp/terraform-provider-aws#7918
  • Loading branch information
Eduardo Lopez authored and czimergebot committed May 28, 2019
1 parent bdf80b2 commit 982ff3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws-acm-cert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module "cert" {

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| allow\_validation\_record\_overwrite | Allow the overwrite of validation records. This is needed if you are creating certificates in multiple regions. | string | `"true"` | no |
| aws\_route53\_zone\_id | | string | n/a | yes |
| cert\_domain\_name | Like www.foo.bar.com or *.foo.bar.com | string | n/a | yes |
| cert\_subject\_alternative\_names | A map of <alternative_domain:route53_zone_id> | map | `<map>` | no |
Expand Down
2 changes: 2 additions & 0 deletions aws-acm-cert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ resource "aws_route53_record" "cert_validation" {
zone_id = "${lookup(var.cert_subject_alternative_names, lookup(aws_acm_certificate.cert.domain_validation_options[count.index], "domain_name"), var.aws_route53_zone_id)}"
records = ["${lookup(aws_acm_certificate.cert.domain_validation_options[count.index], "resource_record_value")}"]
ttl = "${var.validation_record_ttl}"

allow_overwrite = "${var.allow_validation_record_overwrite}"
}

resource "aws_acm_certificate_validation" "cert" {
Expand Down
6 changes: 6 additions & 0 deletions aws-acm-cert/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ variable "owner" {
type = "string"
description = "Owner for tagging and naming. See [doc](../README.md#consistent-tagging)."
}

variable "allow_validation_record_overwrite" {
type = "string"
description = "Allow the overwrite of validation records. This is needed if you are creating certificates in multiple regions."
default = true
}

0 comments on commit 982ff3b

Please sign in to comment.