Skip to content

Commit 2b53d66

Browse files
authored
feat: Revert of removing NONE validation method and set default to null (#140)
1 parent c14ba5a commit 2b53d66

File tree

8 files changed

+10
-30
lines changed

8 files changed

+10
-30
lines changed

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ module "acm" {
1313
1414
domain_name = "my-domain.com"
1515
zone_id = "Z2ES7B9AZ6SHAE"
16-
17-
validation_method = "DNS"
1816
1917
subject_alternative_names = [
2018
"*.my-domain.com",
@@ -39,8 +37,6 @@ module "acm" {
3937
domain_name = "weekly.tf"
4038
zone_id = "b7d259641bf30b89887c943ffc9d2138"
4139
42-
validation_method = "DNS"
43-
4440
subject_alternative_names = [
4541
"*.weekly.tf",
4642
]
@@ -76,8 +72,6 @@ module "acm" {
7672
domain_name = "my-domain.com"
7773
zone_id = "Z266PL4W4W6MSG"
7874
79-
validation_method = "DNS"
80-
8175
wait_for_validation = true
8276
8377
tags = {
@@ -112,8 +106,6 @@ module "acm" {
112106
"app.sub.my-domain.com",
113107
]
114108
115-
validation_method = "DNS"
116-
117109
create_route53_records = false
118110
validation_record_fqdns = module.route53_records.validation_route53_record_fqdns
119111
}
@@ -129,8 +121,6 @@ module "route53_records" {
129121
create_certificate = false
130122
create_route53_records_only = true
131123
132-
validation_method = "DNS"
133-
134124
distinct_domain_names = module.acm.distinct_domain_names
135125
zone_id = "Z266PL4W4W6MSG"
136126
@@ -218,7 +208,7 @@ No modules.
218208
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to the resource | `map(string)` | `{}` | no |
219209
| <a name="input_validate_certificate"></a> [validate\_certificate](#input\_validate\_certificate) | Whether to validate certificate by creating Route53 record | `bool` | `true` | no |
220210
| <a name="input_validation_allow_overwrite_records"></a> [validation\_allow\_overwrite\_records](#input\_validation\_allow\_overwrite\_records) | Whether to allow overwrite of Route53 records | `bool` | `true` | no |
221-
| <a name="input_validation_method"></a> [validation\_method](#input\_validation\_method) | Which method to use for validation. DNS or EMAIL are valid. This parameter must not be set for certificates that were imported into ACM and then into Terraform. | `string` | `null` | no |
211+
| <a name="input_validation_method"></a> [validation\_method](#input\_validation\_method) | Which method to use for validation. DNS or EMAIL are valid, NONE can be used for certificates that were imported into ACM and then into Terraform. | `string` | `"DNS"` | no |
222212
| <a name="input_validation_option"></a> [validation\_option](#input\_validation\_option) | The domain name that you want ACM to use to send you validation emails. This domain name is the suffix of the email addresses that you want ACM to use. | `any` | `{}` | no |
223213
| <a name="input_validation_record_fqdns"></a> [validation\_record\_fqdns](#input\_validation\_record\_fqdns) | When validation is set to DNS and the DNS validation records are set externally, provide the fqdns for the validation | `list(string)` | `[]` | no |
224214
| <a name="input_validation_timeout"></a> [validation\_timeout](#input\_validation\_timeout) | Define maximum timeout to wait for the validation to complete | `string` | `null` | no |

examples/complete-dns-validation-with-cloudflare/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ Note that this example may create resources which cost money. Run `terraform des
2525
|------|---------|
2626
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
2727
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.40 |
28-
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | >= 3.4, <=3.32 |
28+
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | >= 3.4 |
2929

3030
## Providers
3131

3232
| Name | Version |
3333
|------|---------|
34-
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | >= 3.4, <=3.32 |
34+
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | >= 3.4 |
3535

3636
## Modules
3737

examples/complete-dns-validation-with-cloudflare/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ module "acm" {
2424
]
2525

2626
create_route53_records = false
27-
validation_method = "DNS"
2827
validation_record_fqdns = cloudflare_record.validation[*].hostname
2928

3029
tags = {

examples/complete-dns-validation-with-cloudflare/versions.tf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ terraform {
66
source = "hashicorp/aws"
77
version = ">= 4.40"
88
}
9-
# Terraform v1.0.0 only functional with cloudflare versions less than or equal to 3.33.0
10-
# https://github.com/cloudflare/terraform-provider-cloudflare/issues/2340
11-
# Cloudflare provider version 3.33.0 introduced a regression which produced errors when
12-
# passing credentials via environment variables
13-
# https://github.com/cloudflare/terraform-provider-cloudflare/issues/2184
149
cloudflare = {
1510
source = "cloudflare/cloudflare"
16-
version = ">= 3.4, <=3.32"
11+
version = ">= 3.4"
1712
}
1813
}
1914
}

examples/complete-dns-validation/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ module "acm" {
4646
"alerts.${local.domain_name}",
4747
]
4848

49-
validation_method = "DNS"
50-
5149
tags = {
5250
Name = local.domain_name
5351
}
@@ -83,7 +81,6 @@ module "acm_only" {
8381
]
8482

8583
create_route53_records = false
86-
validation_method = "DNS"
8784
validation_record_fqdns = module.route53_records_only.validation_route53_record_fqdns
8885
}
8986

@@ -96,7 +93,6 @@ module "route53_records_only" {
9693

9794
create_certificate = false
9895
create_route53_records_only = true
99-
validation_method = "DNS"
10096

10197
zone_id = local.zone_id
10298
distinct_domain_names = module.acm_only.distinct_domain_names

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ resource "aws_route53_record" "validation" {
6262
}
6363

6464
resource "aws_acm_certificate_validation" "this" {
65-
count = local.create_certificate && var.validation_method != null && var.validate_certificate && var.wait_for_validation ? 1 : 0
65+
count = local.create_certificate && var.validation_method != "NONE" && var.validate_certificate && var.wait_for_validation ? 1 : 0
6666

6767
certificate_arn = aws_acm_certificate.this[0].arn
6868

variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ variable "subject_alternative_names" {
5353
}
5454

5555
variable "validation_method" {
56-
description = "Which method to use for validation. DNS or EMAIL are valid. This parameter must not be set for certificates that were imported into ACM and then into Terraform."
56+
description = "Which method to use for validation. DNS or EMAIL are valid, NONE can be used for certificates that were imported into ACM and then into Terraform."
5757
type = string
58-
default = null
58+
default = "DNS"
5959

6060
validation {
61-
condition = var.validation_method == null || contains(["DNS", "EMAIL"], coalesce(var.validation_method, 0))
62-
error_message = "This variable is optional. Valid values are DNS, EMAIL, or null."
61+
condition = contains(["DNS", "EMAIL", "NONE"], var.validation_method)
62+
error_message = "Valid values are DNS, EMAIL or NONE."
6363
}
6464
}
6565

wrappers/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module "wrapper" {
1212
certificate_transparency_logging_preference = try(each.value.certificate_transparency_logging_preference, var.defaults.certificate_transparency_logging_preference, true)
1313
domain_name = try(each.value.domain_name, var.defaults.domain_name, "")
1414
subject_alternative_names = try(each.value.subject_alternative_names, var.defaults.subject_alternative_names, [])
15-
validation_method = try(each.value.validation_method, var.defaults.validation_method, null)
15+
validation_method = try(each.value.validation_method, var.defaults.validation_method, "DNS")
1616
validation_option = try(each.value.validation_option, var.defaults.validation_option, {})
1717
create_route53_records = try(each.value.create_route53_records, var.defaults.create_route53_records, true)
1818
validation_record_fqdns = try(each.value.validation_record_fqdns, var.defaults.validation_record_fqdns, [])

0 commit comments

Comments
 (0)