terraform-provider-dns icon indicating copy to clipboard operation
terraform-provider-dns copied to clipboard

Optionally ignore DNS resolution errors in data sources

Open sergei-ivanov opened this issue 6 years ago • 4 comments

Terraform Version

Terraform v0.11.8

Affected Resource(s)

  • data.dns_a_record_set
  • data.dns_aaaa_record_set
  • data.dns_cname_record_set

Terraform Configuration Files

data "dns_a_record_set" "example" {
  host = "example.com"
}

resource "google_monitoring_alert_policy" "example" {
  count = "${length(data.dns_a_record_set.example.addrs) > 0 ? 1 : 0}"

# uptime checks configuration for example.com
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

We have most of GCP infrastructure managed by Terraform, but the DNS entries are managed manually on an external name server. I wanted to have some conditional logic in the Terraform plan to create resources that depended on a DNS entry only if that entry existed.

For example, I expected the plan to create a monitoring policy if the DNS entry was resolvable, and no policies if there's no such DNS entry.

Actual Behavior

DNS data source raises an error when there's no entry and the plan aborts.

Steps to Reproduce

terraform apply

Important Factoids

N/A

References

N/A

sergei-ivanov avatar Feb 06 '19 23:02 sergei-ivanov

Anything blocking this from being merged? Would be useful to be able to have an empty string returned rather than failing. Sometimes it's acceptable for a DNS record to not exist at the time terraform runs.

robstonham-pa avatar Dec 01 '20 17:12 robstonham-pa

Anything blocking this from being merged? Would be useful to be able to have an empty string returned rather than failing. Sometimes it's acceptable for a DNS record to not exist at the time terraform runs.

The PR needs to be rebased (again) to resolve the conflicts, but I am reluctant to spend my time on that, because there seems to be little interest from the maintainers to merge it.

sergei-ivanov avatar Dec 03 '20 02:12 sergei-ivanov

@sergei-ivanov I certainly would benefit from this feature and hope I can convince you to get it over the finish line.

I see on your PR that you haven't yet signed the Contributor License Agreement ("CLA") which might be why you aren't getting any maintainer attention on our PR yet.

iAnomaly avatar Jan 04 '22 17:01 iAnomaly

This would be pretty useful for me as well. It looks like another contributor is required to sign the CLA. Unfortunately there are conflicts again. :(

bryanchug avatar Mar 02 '22 11:03 bryanchug