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
The expectation is that terraform provider should fail on the data block if the resource addressed by the data block doesn't exist.
This is not the behavior of terraform kubernetes provider. As a result, I can no longer assume data blocks could be used as assertions that the referenced infrastructure exists. Could there be an opt-in feature on the provider to allow for this behavior?
terraform plan for the following block
data "kubernetes_service_account" "my_svc" {
metadata {
name = "my_svc"
namespace = "kafka"
}
}
output "instance_ip_addr" {
value = data.kubernetes_service_account.my_svc
}
Edit: seems like overtime there has been a number of other providers that had similar issues, though, the general consensus is that data blocks should return an error, and some providers have since fixed the incorrect behavior: hashicorp/terraform-provider-azurerm#1223
The text was updated successfully, but these errors were encountered:
Although the error can be misleading and shouyld be improved
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Provider produced null object
│
│ Provider "provider["registry.terraform.io/hashicorp/kubernetes"]" produced a null value for module.this.data.kubernetes_resource.namespace.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
In this case clearly is not a bug, because the resource doesn't exist.
So why using a dedicated data source for namespace we still get an object with just the name we provided in it, when it doesn't exist?
Based on the discussion: hashicorp/terraform#16380
The expectation is that terraform provider should fail on the data block if the resource addressed by the data block doesn't exist.
This is not the behavior of terraform kubernetes provider. As a result, I can no longer assume data blocks could be used as assertions that the referenced infrastructure exists. Could there be an opt-in feature on the provider to allow for this behavior?
terraform plan for the following block
yields following output:
even though the SA doesn't exist.
Terraform version, Kubernetes provider version and Kubernetes version
Edit: seems like overtime there has been a number of other providers that had similar issues, though, the general consensus is that data blocks should return an error, and some providers have since fixed the incorrect behavior: hashicorp/terraform-provider-azurerm#1223
The text was updated successfully, but these errors were encountered: