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

Adding enable_autopilot=false or via variable to google_container_cluster gives Error: Conflicting configuration arguments #12245

Closed
cxhercules opened this issue Aug 3, 2022 · 2 comments
Assignees
Labels

Comments

@cxhercules
Copy link

Hi I am trying to use a current module and make enable_autopilot a variable option, but just adding it to configuration and setting it to false explicitly returns Error: Conflicting configuration arguments. If I set it up as a variable I get more of the same error.

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 v1.2.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.31.0
+ provider registry.terraform.io/hashicorp/google-beta v4.31.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.12.1
+ provider registry.terraform.io/hashicorp/random v3.3.2
+ provider registry.terraform.io/hashicorp/time v0.7.2

Affected Resource(s)

  • google_container_cluster

Terraform Configuration Files

resource "google_container_cluster" "cluster" {
  provider           = google
  name               = var.name
  location           = var.location
  initial_node_count = 1
  network            = var.vpc_id
  subnetwork         = var.subnet_id
  min_master_version = "1.21"
  monitoring_service = "monitoring.googleapis.com/kubernetes"

  enable_autopilot = var.enable_autopilot

  release_channel {
    channel = var.release_channel
  }

  workload_identity_config {
    workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
  }

  remove_default_node_pool = true

  ip_allocation_policy {
    cluster_ipv4_cidr_block  = "10.0.0.0/12"
    services_ipv4_cidr_block = "192.168.0.0/17"
  }

  network_policy {
    # Enabling this with Dataplane v2 results in an error, despite it having that feature always on
    enabled = var.enable_dataplane_v2 ? false : true
  }

  datapath_provider = var.enable_dataplane_v2 ? "ADVANCED_DATAPATH" : "DATAPATH_PROVIDER_UNSPECIFIED"

  database_encryption {
    key_name = google_kms_crypto_key.cmek.id
    state    = "ENCRYPTED"
  }

  enable_shielded_nodes = true
  dynamic "private_cluster_config" {
    for_each = var.private_cluster ? [1] : []
    content {
      enable_private_nodes    = true
      enable_private_endpoint = true
      master_ipv4_cidr_block  = "10.10.10.0/28"
      master_global_access_config {
        enabled = false
      }
    }
  }

  master_authorized_networks_config {
    dynamic "cidr_blocks" {
      for_each = var.private_cluster ? {} : merge(local.vpn1, local.vpn2)
      content {
        cidr_block   = cidr_blocks.value
        display_name = cidr_blocks.key
      }
    }
  }

  addons_config {
    gcp_filestore_csi_driver_config {
      enabled = true
    }
  }

  depends_on = [
    google_kms_crypto_key_iam_binding.cmek
  ]
}

Debug Output


│ Error: Conflicting configuration arguments

│   with module.control_plane.google_container_cluster.cluster,
│   on ../../modules/control_plane/gcp/gke/main.tf line 58, in resource "google_container_cluster" "cluster":
│   58: resource "google_container_cluster" "cluster" {

│ "workload_identity_config": conflicts with enable_autopilot


│ Error: Conflicting configuration arguments

│   with module.control_plane.google_container_cluster.cluster,
│   on ../../modules/control_plane/gcp/gke/main.tf line 58, in resource "google_container_cluster" "cluster":
│   58: resource "google_container_cluster" "cluster" {

│ "network_policy": conflicts with enable_autopilot


│ Error: Conflicting configuration arguments

│   with module.control_plane.google_container_cluster.cluster,
│   on ../../modules/control_plane/gcp/gke/main.tf line 81, in resource "google_container_cluster" "cluster":
│   81:   remove_default_node_pool = true

│ "remove_default_node_pool": conflicts with enable_autopilot


│ Error: Conflicting configuration arguments

│   with module.control_plane.google_container_cluster.cluster,
│   on ../../modules/control_plane/gcp/gke/main.tf line 101, in resource "google_container_cluster" "cluster":
│  101:   enable_shielded_nodes = true

│ "enable_shielded_nodes": conflicts with enable_autopilot


│ Error: Conflicting configuration arguments

│   with module.control_plane.google_container_cluster.cluster,
│   on ../../modules/control_plane/gcp/gke/main.tf line 125, in resource "google_container_cluster" "cluster":
│  125:     gcp_filestore_csi_driver_config {

│ "addons_config.0.gcp_filestore_csi_driver_config": conflicts with enable_autopilot

Expected Behavior

I would of expected that adding optional feature with default value of false or variable value with default set to false to not activate conflicts.

Actual Behavior

The actual behavior was that with variable value set to false as default I still got conflicts and with me setting value statically to false inline it gave less conflicts, but still produce conflicts although not "enabled".

Steps to Reproduce

  1. terraform plan

Important Factoids

I did not get to next step of making conflicting items possibly optional or dynamic as initial state is conflicting.

@cxhercules cxhercules added the bug label Aug 3, 2022
@edwardmedia edwardmedia self-assigned this Aug 3, 2022
@edwardmedia
Copy link
Contributor

@cxhercules I see what you are experiencing. By removing enable_autopilot, the plan-time validation error will go away. I believe you know that. There are many other fields that share the same behavior. Basically it prevents conflicting fields showing up in the same plan. This is by design.

@github-actions
Copy link

github-actions bot commented Sep 3, 2022

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2022
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