Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d/dns_managed_zone: Error out if zone is not found #560

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Oct 10, 2017

Data source should almost never silently fail when the resource doesn't exist, because:

a. There's most likely a good reason user chose to use a data source instead of a resource. They don't manage the resource and expect it to be there and rely on it.
b. It leads to confusing errors, e.g.

data "google_dns_managed_zone" "gcp" {
  name = "bla-blah"
}

resource "google_dns_record_set" "www" {
  name = "www.${data.google_dns_managed_zone.gcp.dns_name}"
  type = "A"
  ttl  = 5

  managed_zone = "${data.google_dns_managed_zone.gcp.name}"
  rrdatas = ["10.10.0.2"]
}
Error applying plan:

1 error(s) occurred:

* google_dns_record_set.www: Resource 'data.google_dns_managed_zone.gcp' not found for variable 'data.google_dns_managed_zone.gcp.name'

Test results

TF_ACC=1 go test ./google -v -run=TestAccDataSourceDnsManagedZone_basic -timeout 120m
=== RUN   TestAccDataSourceDnsManagedZone_basic
--- PASS: TestAccDataSourceDnsManagedZone_basic (5.14s)
PASS
ok  	github.com/terraform-providers/terraform-provider-google/google	5.169s

@radeksimko radeksimko added the bug label Oct 10, 2017
@radeksimko radeksimko changed the title d/dns_managed_zone: Error out if zone is not found [WIP] d/dns_managed_zone: Error out if zone is not found Oct 10, 2017
@radeksimko radeksimko changed the title [WIP] d/dns_managed_zone: Error out if zone is not found d/dns_managed_zone: Error out if zone is not found Oct 10, 2017
@radeksimko radeksimko merged commit 44f4773 into master Oct 10, 2017
@radeksimko radeksimko deleted the b-ds-dns-mz-404 branch October 10, 2017 17:22
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
…-404

d/dns_managed_zone: Error out if zone is not found
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants