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

Terraform Google provider >= 2.4 throws error: "node_pool": conflicts with remove_default_node_pool #143

Closed
dijitali opened this issue Apr 24, 2019 · 7 comments · Fixed by #155
Labels
bug Something isn't working

Comments

@dijitali
Copy link

I'm just trying out this module for a PoC and ran into some difficulties following the v2.0.0 release. I created a cluster OK using with v1.0.1 but just upgraded and am now getting this error when running a plan.

I've stripped back my config and still see the same issue with the main example config in the
README.md

Error: module.gke.google_container_cluster.primary: "node_pool": conflicts with remove_default_node_pool

Error: module.gke.google_container_cluster.primary: "remove_default_node_pool": conflicts with node_pool

I'm not setting remove_default_node_pool option but have tried explicitly setting both true and false and get the same error.

Terraform Version

Terraform v0.11.13
+ provider.google v2.5.1
+ provider.google-beta v2.5.1
+ provider.kubernetes v1.6.2
+ provider.null v2.1.1
+ provider.random v2.1.1

Affected Resource(s)

  • module.gke.google_container_cluster.primary

Terraform Configuration Files

provider "google" {
  project     = "<PROJECT ID>"
  region      = "us-central1"
  zone        = "us-central1-a"
}
provider "google-beta" {
  project     = "<PROJECT ID>"
  region      = "us-central1"
  zone        = "us-central1-a"
}
module "gke" {

  source                     = "terraform-google-modules/kubernetes-engine/google"
  project_id                 = "<PROJECT ID>"
  name                       = "gke-test-1"
  region                     = "us-central1"
  zones                      = ["us-central1-a", "us-central1-b", "us-central1-f"]
  network                    = "vpc-01"
  subnetwork                 = "us-central1-01"
  ip_range_pods              = "us-central1-01-gke-01-pods"
  ip_range_services          = "us-central1-01-gke-01-services"
  http_load_balancing        = false
  horizontal_pod_autoscaling = true
  kubernetes_dashboard       = true
  network_policy             = true
  remove_default_node_pool   = true

  node_pools = [
    {
      name               = "default-node-pool"
      machine_type       = "n1-standard-2"
      min_count          = 1
      max_count          = 100
      disk_size_gb       = 100
      disk_type          = "pd-standard"
      image_type         = "COS"
      auto_repair        = true
      auto_upgrade       = true
      service_account    = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
      preemptible        = false
      initial_node_count = 80
    },
  ]

  node_pools_oauth_scopes = {
    all = []

    default-node-pool = [
      "https://www.googleapis.com/auth/cloud-platform",
    ]
  }

  node_pools_labels = {
    all = {}

    default-node-pool = {
      default-node-pool = "true"
    }
  }

  node_pools_metadata = {
    all = {}

    default-node-pool = {
      node-pool-metadata-custom-value = "my-node-pool"
    }
  }

  node_pools_taints = {
    all = []

    default-node-pool = [
      {
        key    = "default-node-pool"
        value  = "true"
        effect = "PREFER_NO_SCHEDULE"
      },
    ]
  }

  node_pools_tags = {
    all = []

    default-node-pool = [
      "default-node-pool",
    ]
  }
}

Expected Behavior

Terraform creates plan successfully.

Actual Behavior

terraform plan errors with

Warning: module.gke.data.google_container_engine_versions.region: "region": [DEPRECATED] Use location instead



Warning: module.gke.data.google_container_engine_versions.zone: "zone": [DEPRECATED] Use location instead



Warning: module.gke.google_container_cluster.primary: "region": [DEPRECATED] Use location instead



Warning: module.gke.google_container_node_pool.pools: "region": [DEPRECATED] use location instead



Error: module.gke.google_container_cluster.primary: "node_pool": conflicts with remove_default_node_pool



Error: module.gke.google_container_cluster.primary: "remove_default_node_pool": conflicts with node_pool

Steps to Reproduce

  1. terraform plan
@dijitali
Copy link
Author

dijitali commented Apr 24, 2019

I've also tried specifying version = "~> 2.2" for the google and google-beta providers as seems to be used in some of the examples directory in this repo but get the same error.

If I lock to version = "~> 2.0.0" and explictly reference the google-beta provider, as was suggested in #27, I get a different error though:

provider "google" {
  version     = "~> 2.0.0"
  project     = "<PROJECT ID>"
  region      = "us-central1"
  zone        = "us-central1-a"
}
provider "google-beta" {
  version     = "~> 2.0.0"
  project     = "<PROJECT ID>"
  region      = "us-central1"
  zone        = "us-central1-a"
}
module "gke" {
  providers = {
    google ="google-beta"
  }
  source                     = "terraform-google-modules/kubernetes-engine/google"

# abbreviated

Gives:

Error: module.gke.google_container_cluster.primary: : invalid or unknown key: node_locations

@morgante
Copy link
Contributor

Can you try locking to version = 2.3?

@zioproto
Copy link
Contributor

@morgante I can confirm that locking both google and google-beta providers to version 2.3 fixes this issue. Thank you

@dijitali
Copy link
Author

That's sorted it for me too. Thanks!

In general, how should I be determining what provider version is compatible with modules in terraform-google-modules?

There's a section in the main README.md but it suggests v2.0.0 is required at present.

@morgante
Copy link
Contributor

@dijitali The most reliable way is to check the module version pinned in the examples.

@dijitali
Copy link
Author

@morgante - that example link seems out of date as it has them pinned to v2.2.x at the moment, which is broken.

Are the integration tests running and passing on this module at the moment? Can we look to those to see what provider version should be working?

@morgante
Copy link
Contributor

@dijitali So our pinning was slightly broken, which is why I have a PR to fix it but 2.2 and 2.3 should probably both work.

@aaron-lane aaron-lane changed the title v2.0.0 throws error: "node_pool": conflicts with remove_default_node_pool Terraform Google provider >= 2.4 throws error: "node_pool": conflicts with remove_default_node_pool May 2, 2019
@aaron-lane aaron-lane added the bug Something isn't working label May 27, 2019
aaron-lane added a commit that referenced this issue May 27, 2019
CPL-markus pushed a commit to WALTER-GROUP/terraform-google-kubernetes-engine that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants