You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.
# External DNS zone
data "google_dns_managed_zone" "external_zone" {
name = local.zone_name
project = var.project_id
}
resource "google_dns_managed_zone" "external_zone" {
count = (data.google_dns_managed_zone.external_zone.dns_name == null ? 1 : 0)
dns_name = "${var.project_name}.${var.domain_name}"
name = local.zone_name
description = "External DNS zone"
}
Debug Output
Panic Output
Expected Behavior
Script creates the zone first time it is run, and does not attempt to create the zone subsequent runs - each run starting from a fresh tfstate file.
Since Terraform lacks a create-if-necessary mechanism, the count is typically used as a workaround. The Google provider is inconsistent in its support for this workaround. For example, data google_kms_key_ring will have its output attributes null if the key ring doesn't exist (and will not error).
google_dns_managed_zone should provide a way to specify the zone should be created if it does not yet exist.
Actual Behavior
The script errors the first time because data google_dns_managed_zone does not support returning nulls as output.
Steps to Reproduce
terraform apply
Important Factoids
This is normally not needed if terraform tfstate file is maintained. However, due to other bugs, we are blocked use terraform destroy, and thus sometimes we need to start a new state file with an environment that has some existing configuration. And therefore we require a way to create-if-missing.
terraform import is a manual and laborious workaround, but does not always work either due to errors for missing dependencies such as providers that haven't yet been established (catch-22).
References
#0000
The text was updated successfully, but these errors were encountered:
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
google_dns_managed_zone
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Script creates the zone first time it is run, and does not attempt to create the zone subsequent runs - each run starting from a fresh
tfstate
file.Since Terraform lacks a
create-if-necessary
mechanism, thecount
is typically used as a workaround. The Google provider is inconsistent in its support for this workaround. For example,data google_kms_key_ring
will have its output attributesnull
if the key ring doesn't exist (and will not error).google_dns_managed_zone
should provide a way to specify the zone should be created if it does not yet exist.Actual Behavior
The script errors the first time because
data google_dns_managed_zone
does not support returning nulls as output.Steps to Reproduce
terraform apply
Important Factoids
This is normally not needed if terraform
tfstate
file is maintained. However, due to other bugs, we are blocked useterraform destroy
, and thus sometimes we need to start a new state file with an environment that has some existing configuration. And therefore we require a way to create-if-missing.terraform import
is a manual and laborious workaround, but does not always work either due to errors for missing dependencies such as providers that haven't yet been established (catch-22).References
The text was updated successfully, but these errors were encountered: