`
Terraform v0.11.12
provider "google" {
project = "test-isocial"
# region = "europe-west1"
# zone = "europe-west1-b"
region = "us-west2"
zone = "us-west2-b"
}
data "google_compute_image" "centos7" {
family = "centos-7"
project = "centos-cloud"
}
resource "google_compute_instance" "gcp-mgmt01" {
name = "gcp-mgmt01"
machine_type = "f1-micro"
boot_disk {
initialize_params {
image = "${data.google_compute_image.centos7.self_link}"
}
}
metadata = {
purpose = "isocial"
}
network_interface {
network = "default"
access_config {
network_tier = "PREMIUM"
# network_tier = "STANDARD"
}
}
}
resource "google_container_cluster" "primary" {
name = "my-gke-cluster"
region = "us-central1"
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
# Setting an empty username and password explicitly disables basic auth
master_auth {
username = ""
password = ""
}
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
labels = {
foo = "bar"
}
tags = ["foo", "bar"]
}
}
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
region = "us-central1"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
node_config {
# preemptible = true
machine_type = "f1-micro"
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
# The following outputs allow authentication and connectivity to the GKE Cluster
# by using certificate-based authentication.
output "client_certificate" {
value = "${google_container_cluster.primary.master_auth.0.client_certificate}"
}
output "client_key" {
value = "${google_container_cluster.primary.master_auth.0.client_key}"
}
output "cluster_ca_certificate" {
value = "${google_container_cluster.primary.master_auth.0.cluster_ca_certificate}"
}
output "cluster_version" {
value = "${google_container_cluster.primary.master_version}"
}
I run terraform apply.
I run it again, nothing changes
google_container_cluster.primary is recreated
Output : https://gist.github.com/roidelapluie/accd50e74de46c99cde1f0fec3113ef7
Looking at https://www.terraform.io/docs/providers/google/r/container_node_pool.html, you seem to have a mix of what is recommended there in your resource "google_container_cluster" "primary" and resource "google_container_node_pool" "primary_preemptible_nodes" - I believe that if you set remove_default_node_pool = true in google_container_cluster then you should not also specify node_config.
see also #2115
Thanks @mattnworb - that solved my "issue".
Thanks. Not a bug!
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
Looking at https://www.terraform.io/docs/providers/google/r/container_node_pool.html, you seem to have a mix of what is recommended there in your
resource "google_container_cluster" "primary"andresource "google_container_node_pool" "primary_preemptible_nodes"- I believe that if you setremove_default_node_pool = trueingoogle_container_clusterthen you should not also specifynode_config.see also #2115