'My terraform state remain empty on dns_config.cluster_dns_scope using google_container_cluster
Terraform: v1.1.7
Provider: hasicorp/google v4.12.0
I try to spawn a GKE cluster with a specific dns configuration:
resource "google_container_cluster" "primary" {
name = local.cluster_name
location = local.region
remove_default_node_pool = true
initial_node_count = 1
network = module.gke_vpc.network_name
subnetwork = module.gke_vpc.subnetwork_name
project = local.project
dns_config {
cluster_dns = "CLOUD_DNS"
cluster_dns_scope = "VPC_SCOPE"
}
}
TF is able to spawn it, but in its state, the dns_config.cluster_dns_scope remains empty, meaning that when I do a terraform plan I always get a change planed:
cluster_dns_scope : "" -> "VPC_SCOPE"
I tried the different values for cluster_dns_scope:
- DNS_SCOPE_UNSPECIFIED
- CLUSTER_SCOPE
- VPC_SCOPE
But I always get the same result.
I could modify my state as a workarround but the idea is to re-use the same TF module for several projects, so it's not what I want to do.
Any idea?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
