Open fdaguin opened 4 days ago
Confirmed issue!
After trying to create the google_container_cluster
with a value of "/20" it returns the following error messages:
Error: Conflicting configuration arguments
ā
ā with google_container_cluster.container_cluster_20448,
ā on main.tf line 34, in resource "google_container_cluster" "container_cluster_20448":
ā 34: cluster_secondary_range_name = "gke-pods-ip-range"
ā
ā "ip_allocation_policy.0.cluster_secondary_range_name": conflicts with ip_allocation_policy.0.services_ipv4_cidr_block
āµ
ā·
ā Error: Conflicting configuration arguments
ā
ā with google_container_cluster.container_cluster_20448,
ā on main.tf line 35, in resource "google_container_cluster" "container_cluster_20448":
ā 35: services_ipv4_cidr_block = "/20"
ā
ā "ip_allocation_policy.0.services_ipv4_cidr_block": conflicts with ip_allocation_policy.0.cluster_secondary_range_name
Used code:
resource "google_container_cluster" "container_cluster_20448" {
name = "container-cluster-20448"
location = "us-central1-a"
deletion_protection = false
initial_node_count = 3
ip_allocation_policy {
cluster_secondary_range_name = "gke-pods-ip-range"
services_ipv4_cidr_block = "/20"
}
}
Community Note
Terraform Version & Provider Version(s)
Terraform v1.5.2 on linux_amd64
Affected Resource(s)
google_container_cluster
Terraform Configuration
Debug Output
N/A
Expected Behavior
In a GKE Standard cluster running >=1.29, when setting a range size (for example
/22
) throughip_allocation_policy.0.services_ipv4_cidr_block
, GKE assigns IP addresses for Services from a GKE-managed range [1].However, when in Shared VPC setup,
ip_allocation_policy.0.cluster_secondary_range_name
must be used [2].At the moment, the provider does not allow using both attributes at the same time despite being supported by Google APIs.
[1] https://cloud.google.com/kubernetes-engine/docs/concepts/alias-ips#cluster_sizing_secondary_range_svcs [2] https://cloud.google.com/sdk/gcloud/reference/container/clusters/create#--cluster-ipv4-cidr
Actual Behavior
Steps to reproduce
Using a custom provider with the following patch does work:
Important Factoids
N/A
References
N/A
b/380489439