Skip to content

Commit

Permalink
Merge pull request #10 from Flaconi/plt-894
Browse files Browse the repository at this point in the history
PLT-894 - Only run data for the zone when cert needs to created
  • Loading branch information
Engerim authored Jul 26, 2024
2 parents f2d5808 + ee7904b commit 66a70a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
data "cloudflare_zone" "this" {
name = var.zone_name
count = var.create_certificate ? 1 : 0
name = var.zone_name
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "aws_acm_certificate" "this" {
resource "cloudflare_record" "validation" {
count = var.create_certificate && var.validate_certificate ? length(local.distinct_domain_names) : 0

zone_id = data.cloudflare_zone.this.id
zone_id = data.cloudflare_zone.this[0].id
name = element(local.validation_domains, count.index)["resource_record_name"]
type = element(local.validation_domains, count.index)["resource_record_type"]
value = replace(element(local.validation_domains, count.index)["resource_record_value"], "/.$/", "")
Expand Down

0 comments on commit 66a70a6

Please sign in to comment.