Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument Not Expected - Master Authorised Networks CIDR Blocks #4115

Closed
Evesy opened this issue Jul 26, 2019 · 3 comments
Closed

Argument Not Expected - Master Authorised Networks CIDR Blocks #4115

Evesy opened this issue Jul 26, 2019 · 3 comments
Assignees
Labels

Comments

@Evesy
Copy link

Evesy commented Jul 26, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform: 0.12.4
Google Provider: 2.11.0

Affected Resource(s)

  • google_container_cluster

Terraform Configuration Files

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"
  }
}

Expected Behavior

Plan should complete successfully as it does on pre 0.12 TF versions

Actual Behavior

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"?

Steps to Reproduce

  1. Create the above resource on a pre 0.12 version of Terraform & providers
  2. Update to Terraform 0.12 & respective providers
  3. terraform plan

References

There was some discussion about this here but it's unclear where it ended up: hashicorp/terraform#20505

@ghost ghost added the bug label Jul 26, 2019
@Evesy
Copy link
Author

Evesy commented Jul 26, 2019

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"
    }
  }

@paddycarver paddycarver self-assigned this Aug 1, 2019
@paddycarver
Copy link
Contributor

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.

@ghost
Copy link

ghost commented Sep 1, 2019

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!

@ghost ghost locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants