hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

Support use of non RFC-1918 address space in GKE google_container_cluster resource since GCP supports it #13802

Open donjmilligan opened 1 year ago

donjmilligan commented 1 year ago

Community Note

Description

In some enterprise use cases it makes sense to use non RFC-1918 spaces since other ranges are already in use, and this is recognized and supported by GCP. According to GCPs Kubernetes Engine Documentation the use of non-RFC-1918 address space in GKE clusters is supported. We might even say it is encouraged if we need additional IP space. Another location that lists these other RFC ranges as valid for use by GCP is in their Subnets Documentation.

The terraform resource _google_containercluster aught to support other RFC specifications in the cluster_ipv4_cidr field.

New or Affected Resource(s)

google_container_cluster

References

https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips#enable_reserved_ip_ranges

https://cloud.google.com/vpc/docs/subnets#valid-ranges

donjmilligan commented 1 year ago

I have since recognized that removing cluster_ipv4_cidr and using these fields in the ip_allocation_policy block with non RFC-1918 address spaces will allow a terraform plan to complete without any errors regarding RFC 1918.

ip_allocation_policy {
    cluster_ipv4_cidr_block  =
    services_ipv4_cidr_block = 
  }

Shouldn't cluster_ipv4_cidr still also support this?