Skip to content

Commit 913599d

Browse files
committed
make infra plan apply cleanly after import
1 parent 7d9c8de commit 913599d

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

scaletest/terraform/infra/gcp_cluster.tf

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ resource "google_container_cluster" "primary" {
4141
workload_identity_config {
4242
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
4343
}
44+
45+
46+
lifecycle {
47+
ignore_changes = [
48+
maintenance_policy,
49+
release_channel,
50+
remove_default_node_pool
51+
]
52+
}
4453
}
4554

4655
resource "google_container_node_pool" "coder" {
@@ -52,9 +61,6 @@ resource "google_container_node_pool" "coder" {
5261
min_node_count = 1
5362
max_node_count = var.nodepool_size_coder
5463
}
55-
management {
56-
auto_upgrade = false
57-
}
5864
node_config {
5965
oauth_scopes = [
6066
"https://www.googleapis.com/auth/logging.write",
@@ -77,6 +83,9 @@ resource "google_container_node_pool" "coder" {
7783
disable-legacy-endpoints = "true"
7884
}
7985
}
86+
lifecycle {
87+
ignore_changes = [management[0].auto_repair, management[0].auto_upgrade, timeouts]
88+
}
8089
}
8190

8291
resource "google_container_node_pool" "workspaces" {
@@ -85,8 +94,8 @@ resource "google_container_node_pool" "workspaces" {
8594
project = var.project_id
8695
cluster = google_container_cluster.primary.name
8796
autoscaling {
88-
min_node_count = 0
89-
max_node_count = var.nodepool_size_workspaces
97+
min_node_count = 0
98+
total_max_node_count = var.nodepool_size_workspaces
9099
}
91100
management {
92101
auto_upgrade = false
@@ -113,6 +122,9 @@ resource "google_container_node_pool" "workspaces" {
113122
disable-legacy-endpoints = "true"
114123
}
115124
}
125+
lifecycle {
126+
ignore_changes = [management[0].auto_repair, management[0].auto_upgrade, timeouts]
127+
}
116128
}
117129

118130
resource "google_container_node_pool" "misc" {
@@ -146,6 +158,9 @@ resource "google_container_node_pool" "misc" {
146158
disable-legacy-endpoints = "true"
147159
}
148160
}
161+
lifecycle {
162+
ignore_changes = [management[0].auto_repair, management[0].auto_upgrade, timeouts]
163+
}
149164
}
150165

151166
resource "null_resource" "cluster_kubeconfig" {

scaletest/terraform/infra/gcp_db.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ resource "google_sql_database_instance" "db" {
3232
record_client_address = false
3333
}
3434
}
35+
36+
lifecycle {
37+
ignore_changes = [deletion_protection, timeouts]
38+
}
3539
}
3640

3741
resource "google_sql_database" "coder" {
@@ -40,6 +44,9 @@ resource "google_sql_database" "coder" {
4044
name = "${var.name}-coder"
4145
# required for postgres, otherwise db fails to delete
4246
deletion_policy = "ABANDON"
47+
lifecycle {
48+
ignore_changes = [deletion_policy]
49+
}
4350
}
4451

4552
resource "random_password" "coder-postgres-password" {
@@ -58,6 +65,9 @@ resource "google_sql_user" "coder" {
5865
password = random_password.coder-postgres-password.result
5966
# required for postgres, otherwise user fails to delete
6067
deletion_policy = "ABANDON"
68+
lifecycle {
69+
ignore_changes = [deletion_policy, password]
70+
}
6171
}
6272

6373
resource "google_sql_user" "prometheus" {
@@ -68,6 +78,9 @@ resource "google_sql_user" "prometheus" {
6878
password = random_password.prometheus-postgres-password.result
6979
# required for postgres, otherwise user fails to delete
7080
deletion_policy = "ABANDON"
81+
lifecycle {
82+
ignore_changes = [deletion_policy, password]
83+
}
7184
}
7285

7386
locals {

scaletest/terraform/infra/gcp_vpc.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resource "google_compute_subnetwork" "subnet" {
1212
project = var.project_id
1313
region = var.region
1414
network = google_compute_network.vpc.name
15-
ip_cidr_range = "10.200.0.0/24"
15+
ip_cidr_range = var.subnet_cidr
1616
}
1717

1818
resource "google_compute_global_address" "sql_peering" {

scaletest/terraform/infra/vars.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ variable "zone" {
2525
default = "us-east1-c"
2626
}
2727

28+
variable "subnet_cidr" {
29+
description = "CIDR range for the subnet."
30+
default = "10.200.0.0/24"
31+
}
32+
2833
variable "k8s_version" {
2934
description = "Kubernetes version to provision."
3035
default = "1.24"

0 commit comments

Comments
 (0)