Open adviteey1 opened 10 months ago
@adviteey1 Can you try to put taint in google_container_cluster instead?
@edwardmedia Thank you for the response, It will work if I put taint in google_container_cluster. In both versions (4.x.x and 5.x.x) terraform document doesn't have any reference to taint in google_container_node_pool but in google_container_cluster. Am I missing or need to change any thing to work with 5.x.x ?
I can repro the issue. Switching the version in the provider block, we can see a different result
resource "google_service_account" "default" {
account_id = "service-account-id"
display_name = "Service Account"
}
resource "google_container_cluster" "primary" {
name = "my-gke-cluster"
location = "us-central1"
remove_default_node_pool = true
initial_node_count = 1
}
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
cluster = google_container_cluster.primary.id
node_count = 1
node_config {
preemptible = true
machine_type = "e2-medium"
# Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
service_account = google_service_account.default.email
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
taint = [
{
"effect": "NO_SCHEDULE",
"key": "node-purpose",
"value": "platform-apps"
}
]
}
}
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "5.5.0"
# version = "4.62.1"
}
}
}
Hi, I see label changed to bug, is it bug in 5.x.x version?
I tried 5.5 till 5.8 provider versions and its the same bug. So we can't set taint on the nodes in the pool atm...
Hi, I also face the same issue, basically removing the previously taint argument doesn't trigger any changes at all.
Terraform version: 1.5.3 google provider version: 5.8.0
Test:
resource "google_container_node_pool" "node-pool" {
...
node_config {
...
#Test
#taint = var.taints
}
^this results in zero change
Ok so its a little diff syntaks now. This one will work:
taint {
effect = "NO_SCHEDULE"
key = "key1"
value = "value1"
}
taint {
effect = "NO_SCHEDULE"
key = "key2"
value = "value2"
}
Tested in 5.8 and all good.
Any update for this?
Hello, any news about it ?
I'm using:
Terraform v1.4.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v5.15.0
+ provider registry.terraform.io/hashicorp/google-beta v5.15.0
and i'm facing with the same issue:
❯ terraform apply
╷
│ Error: Unsupported argument
│
│ on container-engine.tf line 210, in resource "google_container_node_pool" "container_node_pool_kungfu":
│ 210: taint = [
│
│ An argument named "taint" is not expected here. Did you mean to define a block of type "taint"?
The taint can be created on the cluster or on the node pool, and in my use case i can't use the cluster because i have a cluster with multiple node pools.
Have a nice day 👋
As @zzorica mentioned syntax changed. Below is working for me,
taint { effect = "NO_SCHEDULE" key = "key1" value = "value1" }
If you have multiple use dynamic resorce as below.
dynamic "taint" {
for_each = var.taints
content {
key = key
value = tvalue
effect = effect
}
Hello!
I´m from the future!
I´d like to tell you all that today (19-Fev-2024) the documentation (for all provider versions I looked at) still lacks this information.
It´d be great to have it updated, saving our lifetime to more valuable stuff.
Best Regards!
Below one worked for me. What is the process to update docs?
resource "google_container_node_pool" "special-pool" {
node_config {
taint {
key = "special"
value = "special-value"
effect = "special-effect"
}
}
}
Ok so its a little diff syntaks now. This one will work:
taint { effect = "NO_SCHEDULE" key = "key1" value = "value1" } taint { effect = "NO_SCHEDULE" key = "key2" value = "value2" }
Tested in 5.8 and all good.
Thank you @zzorica! This works also for v5.34.0.
v5.34.0 doc is still confusing: https://registry.terraform.io/providers/hashicorp/google/5.34.0/docs/resources/container_cluster#taint says "A list of Kubernetes taints to apply to nodes".
Hi,
I'm facing issue with taints while upgrading google provider version from 4.62.1 to 5.0.0.
Following is the terraform code,
variable:
Error: │ Error: Unsupported argument │ │ on main.tf line 219, in resource "google_container_node_pool" "taint_nodes": │ 219: taint = each.value["taints"] │ │ An argument named "taint" is not expected here. Did you mean to define a │ block of type "taint"?
It is working fine with version 4.62.1 but not with 5.0.0, how to resolve this? Appriciate the help.
b/313874078