Terraform: 0.12.4
Google Provider: 2.11.0
resource "google_container_cluster" "cluster" {
name = "${var.name}"
# What zones should we run in
location = "${var.primary_zone}"
enable_legacy_abac = false
initial_node_count = 1
node_config {
machine_type = "${var.machine["type"]}"
disk_size_gb = "100"
oauth_scopes = "${var.gke_node_scopes}"
preemptible = false
}
remove_default_node_pool = true
lifecycle {
ignore_changes = ["initial_node_count", "network_policy", "node_config", "addons_config[0].horizontal_pod_autoscaling", "node_version"]
}
master_authorized_networks_config {
cidr_blocks = [
{
cidr_block = "1.2.3.4/32",
display_name = "redacted"
},
{
cidr_block = "1.2.3.4/32",
display_name = "redacted"
},
{
cidr_block = "1.2.3.4/32",
display_name = "redacted"
}
]
}
# Enable network policy for custom rules
network_policy {
enabled = false
provider = "CALICO"
}
# Network configuration
network = "${var.network}"
subnetwork = "${google_compute_subnetwork.vpc_regional_subnet.name}"
# Logging and monitoring configuration
monitoring_service = "none"
logging_service = "none"
min_master_version = "${var.kubernetes_version}"
node_version = "${var.kubernetes_version}"
# Add on configuration
addons_config {
http_load_balancing {
disabled = true
}
horizontal_pod_autoscaling {
disabled = true
}
kubernetes_dashboard {
disabled = true
}
}
ip_allocation_policy {
cluster_secondary_range_name = "${var.name}-pods"
services_secondary_range_name = "${var.name}-services"
}
timeouts {
create = "10m"
delete = "30m"
update = "2h"
}
}
Plan should complete successfully as it does on pre 0.12 TF versions
Error: Unsupported argument
on modules/container-cluster/main.tf line 115, in resource "google_container_cluster" "cluster":
115: cidr_blocks = [
An argument named "cidr_blocks" is not expected here. Did you mean to define a
block of type "cidr_blocks"?
terraform planThere was some discussion about this here but it's unclear where it ended up: https://github.com/hashicorp/terraform/issues/20505
Looks to work with the below instead
master_authorized_networks_config {
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
cidr_blocks {
cidr_block = "1.2.3.4/32"
display_name = "redacted"
}
}
As mentioned in the terraform 0.12 upgrade guide, you can no longer use the cidr_blocks = [{ ... }] attribute format in your config files, you need to use the cidr_blocks { } block format.
This is, unfortunately, outside the control of the provider and is documented behavior, so I'm going to close this issue out, but if you have further issues or I've misunderstood what's going on here, please feel free to reply and I can take a look again.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
Most helpful comment
As mentioned in the terraform 0.12 upgrade guide, you can no longer use the
cidr_blocks = [{ ... }]attribute format in your config files, you need to use thecidr_blocks { }block format.This is, unfortunately, outside the control of the provider and is documented behavior, so I'm going to close this issue out, but if you have further issues or I've misunderstood what's going on here, please feel free to reply and I can take a look again.