Skip to content

Commit 27664c5

Browse files
Add zone id (#49)
* zone id * Pass in zone id directly * Update test to use zone id * Update variables.tf * Auto Format * Update main.tf Co-authored-by: cloudpossebot <[email protected]>
1 parent 98ec4ac commit 27664c5

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Available targets:
194194
| <a name="input_ttl"></a> [ttl](#input\_ttl) | The TTL of the record to add to the DNS zone to complete certificate validation | `string` | `"300"` | no |
195195
| <a name="input_validation_method"></a> [validation\_method](#input\_validation\_method) | Method to use for validation, DNS or EMAIL | `string` | `"DNS"` | no |
196196
| <a name="input_wait_for_certificate_issued"></a> [wait\_for\_certificate\_issued](#input\_wait\_for\_certificate\_issued) | Whether to wait for the certificate to be issued by ACM (the certificate status changed from `Pending Validation` to `Issued`) | `bool` | `false` | no |
197+
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | The zone id of the Route53 Hosted Zone which can be used instead of `var.zone_name`. | `string` | `null` | no |
197198
| <a name="input_zone_name"></a> [zone\_name](#input\_zone\_name) | The name of the desired Route53 Hosted Zone | `string` | `""` | no |
198199

199200
## Outputs

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
| <a name="input_ttl"></a> [ttl](#input\_ttl) | The TTL of the record to add to the DNS zone to complete certificate validation | `string` | `"300"` | no |
5454
| <a name="input_validation_method"></a> [validation\_method](#input\_validation\_method) | Method to use for validation, DNS or EMAIL | `string` | `"DNS"` | no |
5555
| <a name="input_wait_for_certificate_issued"></a> [wait\_for\_certificate\_issued](#input\_wait\_for\_certificate\_issued) | Whether to wait for the certificate to be issued by ACM (the certificate status changed from `Pending Validation` to `Issued`) | `bool` | `false` | no |
56+
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | The zone id of the Route53 Hosted Zone which can be used instead of `var.zone_name`. | `string` | `null` | no |
5657
| <a name="input_zone_name"></a> [zone\_name](#input\_zone\_name) | The name of the desired Route53 Hosted Zone | `string` | `""` | no |
5758

5859
## Outputs

examples/complete/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module "zone" {
1414
module "acm_request_certificate" {
1515
source = "../../"
1616
domain_name = module.zone.zone_name
17+
zone_id = module.zone.zone_id
1718
validation_method = var.validation_method
1819
ttl = var.ttl
1920
subject_alternative_names = ["*.${module.zone.zone_name}"]

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ locals {
2121

2222
data "aws_route53_zone" "default" {
2323
count = local.process_domain_validation_options ? 1 : 0
24-
name = local.zone_name
24+
zone_id = var.zone_id
25+
name = try(length(var.zone_id), 0) == 0 ? local.zone_name : null
2526
private_zone = false
2627
}
2728

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ variable "zone_name" {
3939
description = "The name of the desired Route53 Hosted Zone"
4040
}
4141

42+
variable "zone_id" {
43+
type = string
44+
default = null
45+
description = "The zone id of the Route53 Hosted Zone which can be used instead of `var.zone_name`."
46+
}
47+
4248
variable "certificate_transparency_logging_preference" {
4349
type = bool
4450
default = true

0 commit comments

Comments
 (0)