Skip to content

Commit 8c4e6bc

Browse files
committed
chore: add hcledit for tf resource fixup
1 parent ed73a79 commit 8c4e6bc

File tree

28 files changed

+13
-105
lines changed

28 files changed

+13
-105
lines changed

build/int.cloudbuild.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ steps:
6363
echo -n "Folders in scope for tests:"
6464
find . -type d -printf '%P\n'
6565
66+
# Resource specific fixup for E2E testing using hcledit
67+
mkdir -p .hcledit-tmp
68+
wget -P .hcledit-tmp/ https://github.com/minamijoyo/hcledit/releases/download/v0.2.17/hcledit_0.2.17_linux_amd64.tar.gz
69+
checksum=$(sha256sum .hcledit-tmp/hcledit_0.2.17_linux_amd64.tar.gz | awk '{print $1}')
70+
if [ "$checksum" != "5e085bd319c84c74e87b915ab2c1f95afccb2d4326be481fbe19c1d7a0eb5fee" ]; then
71+
echo "Checksum verification failed!"
72+
exit 1
73+
fi
74+
tar -xzf .hcledit-tmp/hcledit_0.2.17_linux_amd64.tar.gz -C .hcledit-tmp/
75+
76+
# Add `deletion_protection = false`` to google_container_cluste.default resources
77+
find . -name "*.tf" -print | xargs -t -I {} .hcledit-tmp/hcledit attribute append resource.google_container_cluster.default.deletion_protection 'false' -u -f {}
6678
- id: prepare
6779
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
6880
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && prepare_environment']

gke/autopilot/basic/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,5 @@ resource "google_container_cluster" "default" {
2020
location = "us-central1"
2121

2222
enable_autopilot = true
23-
24-
# Set `deletion_protection` to `true` will ensure that one cannot
25-
# accidentally delete this instance by use of Terraform.
26-
deletion_protection = false
2723
}
2824
# [END gke_autopilot_basic]

gke/autopilot/config_sync/git/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ resource "google_container_cluster" "default" {
2626
}
2727

2828
enable_autopilot = true
29-
30-
# Set `deletion_protection` to `true` will ensure that one cannot
31-
# accidentally delete this instance by use of Terraform.
32-
deletion_protection = false
3329
}
3430

3531
resource "google_gke_hub_feature" "configmanagement_feature" {

gke/autopilot/config_sync/oci/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ resource "google_container_cluster" "default" {
2626
}
2727

2828
enable_autopilot = true
29-
30-
# Set `deletion_protection` to `true` will ensure that one cannot
31-
# accidentally delete this instance by use of Terraform.
32-
deletion_protection = false
3329
}
3430

3531
resource "google_gke_hub_feature" "configmanagement_feature" {

gke/autopilot/iap/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ resource "google_container_cluster" "default" {
2222
location = "us-central1"
2323

2424
enable_autopilot = true
25-
26-
# Set `deletion_protection` to `true` will ensure that one cannot
27-
# accidentally delete this instance by use of Terraform.
28-
deletion_protection = false
2925
}
3026

3127
# Required for internal ingress

gke/autopilot/labels/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,5 @@ resource "google_container_cluster" "default" {
2424
resource_labels = {
2525
foo = "bar"
2626
}
27-
28-
# Set `deletion_protection` to `true` will ensure that one cannot
29-
# accidentally delete this instance by use of Terraform.
30-
deletion_protection = false
3127
}
3228
# [END gke_autopilot_labels]

gke/autopilot/mesh/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ resource "google_container_cluster" "default" {
3535
fleet {
3636
project = data.google_project.default.project_id
3737
}
38-
39-
# Set `deletion_protection` to `true` will ensure that one cannot
40-
# accidentally delete this instance by use of Terraform.
41-
deletion_protection = false
4238
}
4339

4440
resource "google_gke_hub_feature" "default" {

gke/autopilot/policycontroller/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ resource "google_container_cluster" "default" {
3636
fleet {
3737
project = data.google_project.default.project_id
3838
}
39-
40-
# Set `deletion_protection` to `true` will ensure that one cannot
41-
# accidentally delete this instance by use of Terraform.
42-
deletion_protection = false
4339
}
4440

4541
resource "google_gke_hub_feature" "default" {

gke/autopilot/release_channel/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,5 @@ resource "google_container_cluster" "default" {
2424
release_channel {
2525
channel = "REGULAR"
2626
}
27-
28-
# Set `deletion_protection` to `true` will ensure that one cannot
29-
# accidentally delete this instance by use of Terraform.
30-
deletion_protection = false
3127
}
3228
# [END gke_autopilot_release_channel]

gke/autopilot/reservation/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ resource "google_container_cluster" "default" {
2121
location = "us-central1"
2222

2323
enable_autopilot = true
24-
25-
# Set `deletion_protection` to `true` will ensure that one cannot
26-
# accidentally delete this instance by use of Terraform.
27-
deletion_protection = false
2824
}
2925

3026
# [START gke_autopilot_reservation_specific_reservation]

0 commit comments

Comments
 (0)