Skip to content

Commit

Permalink
Clean terraform run against staging and production
Browse files Browse the repository at this point in the history
Signed-off-by: Doc Ritezel <[email protected]>
  • Loading branch information
erikamov authored and ohrite committed Feb 18, 2025
1 parent 2aa1c59 commit 8ddc37e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 167 deletions.
9 changes: 7 additions & 2 deletions iac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ $ terraform init
Run `terraform init` against each nested resource:

```bash
$ find . -name 'terraform.tfstate' | xargs dirname | xargs -I'{}' terraform -chd
ir='{}' init
$ find . -name 'terraform.tfstate' | xargs dirname | xargs -I'{}' terraform -chdir='{}' init
```

To see any outstanding changes, run `terraform plan` against each nested resource:

```bash
$ find . -name 'terraform.tfstate' | xargs dirname | xargs -I'{}' terraform -chdir='{}' plan
```
42 changes: 0 additions & 42 deletions iac/cal-itp-data-infra/disks/us/compute_disk.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1279,27 +1279,6 @@ resource "google_compute_disk" "tfer--us-west1-c-002F-gke-data-infra-apps-jobs-v
zone = "us-west1-c"
}

resource "google_compute_disk" "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b" {
image = "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/gke-1308-gke1128001-cos-113-18244-236-70-c-cgpv1-pre"

labels = {
goog-gke-cluster-id-base32 = "b7q6s5ghvzbrxcigz62lkdgeeggldd76ipme2xfbzcvpmcrghpqq"
goog-gke-node = ""
goog-gke-volume = ""
goog-k8s-cluster-location = "us-west1"
goog-k8s-cluster-name = "data-infra-apps"
goog-k8s-node-pool-name = "jupyterhub-users"
}

name = "gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b"
physical_block_size_bytes = "4096"
project = "cal-itp-data-infra"
provisioned_iops = "0"
size = "100"
type = "pd-standard"
zone = "us-west1-c"
}

resource "google_compute_disk" "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x" {
image = "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/gke-1308-gke1128001-cos-113-18244-236-70-c-cgpv1-pre"

Expand All @@ -1321,27 +1300,6 @@ resource "google_compute_disk" "tfer--us-west1-c-002F-gke-data-infra-apps-jupyte
zone = "us-west1-c"
}

resource "google_compute_disk" "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr" {
image = "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/gke-1308-gke1128001-cos-113-18244-236-70-c-cgpv1-pre"

labels = {
goog-gke-cluster-id-base32 = "b7q6s5ghvzbrxcigz62lkdgeeggldd76ipme2xfbzcvpmcrghpqq"
goog-gke-node = ""
goog-gke-volume = ""
goog-k8s-cluster-location = "us-west1"
goog-k8s-cluster-name = "data-infra-apps"
goog-k8s-node-pool-name = "jupyterhub-users"
}

name = "gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr"
physical_block_size_bytes = "4096"
project = "cal-itp-data-infra"
provisioned_iops = "0"
size = "100"
type = "pd-standard"
zone = "us-west1-c"
}

resource "google_compute_disk" "tfer--us-west1-c-002F-pvc-32c3a666-3ae5-4cfc-8129-84f571239f42" {
description = "{\"kubernetes.io/created-for/pv/name\":\"pvc-32c3a666-3ae5-4cfc-8129-84f571239f42\",\"kubernetes.io/created-for/pvc/name\":\"claim-cathyxlin\",\"kubernetes.io/created-for/pvc/namespace\":\"jupyterhub\",\"storage.gke.io/created-by\":\"pd.csi.storage.gke.io\"}"

Expand Down
8 changes: 0 additions & 8 deletions iac/cal-itp-data-infra/disks/us/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,10 @@ output "google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jobs-v1-62
value = google_compute_disk.tfer--us-west1-c-002F-gke-data-infra-apps-jobs-v1-625ec063-5q8v.self_link
}

output "google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b_self_link" {
value = google_compute_disk.tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b.self_link
}

output "google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x_self_link" {
value = google_compute_disk.tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x.self_link
}

output "google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr_self_link" {
value = google_compute_disk.tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr.self_link
}

output "google_compute_disk_tfer--us-west1-c-002F-pvc-32c3a666-3ae5-4cfc-8129-84f571239f42_self_link" {
value = google_compute_disk.tfer--us-west1-c-002F-pvc-32c3a666-3ae5-4cfc-8129-84f571239f42.self_link
}
Expand Down
106 changes: 2 additions & 104 deletions iac/cal-itp-data-infra/disks/us/terraform.tfstate
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,10 @@
"value": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jobs-v1-625ec063-5q8v",
"type": "string"
},
"google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b_self_link": {
"value": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"type": "string"
},
"google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x_self_link": {
"value": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x",
"type": "string"
},
"google_compute_disk_tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr_self_link": {
"value": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"type": "string"
},
"google_compute_disk_tfer--us-west1-c-002F-pvc-32c3a666-3ae5-4cfc-8129-84f571239f42_self_link": {
"value": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/pvc-32c3a666-3ae5-4cfc-8129-84f571239f42",
"type": "string"
Expand Down Expand Up @@ -2421,8 +2413,7 @@
"source_snapshot_encryption_key.#": "0",
"source_snapshot_id": "",
"type": "pd-standard",
"users.#": "1",
"users.0": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"users.#": "0",
"zone": "us-west1-c"
},
"sensitive_attributes": []
Expand Down Expand Up @@ -2770,8 +2761,7 @@
"source_snapshot_encryption_key.#": "0",
"source_snapshot_id": "",
"type": "pd-standard",
"users.#": "1",
"users.0": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"users.#": "0",
"zone": "us-west1-c"
},
"sensitive_attributes": []
Expand Down Expand Up @@ -3277,52 +3267,6 @@
}
]
},
{
"mode": "managed",
"type": "google_compute_disk",
"name": "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
"instances": [
{
"schema_version": 0,
"attributes_flat": {
"creation_timestamp": "2025-02-08T03:11:16.977-08:00",
"description": "",
"disk_encryption_key.#": "0",
"id": "us-west1-c/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"image": "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/gke-1308-gke1128001-cos-113-18244-236-70-c-cgpv1-pre",
"label_fingerprint": "xqr1XRsDpKE=",
"labels.%": "6",
"labels.goog-gke-cluster-id-base32": "b7q6s5ghvzbrxcigz62lkdgeeggldd76ipme2xfbzcvpmcrghpqq",
"labels.goog-gke-node": "",
"labels.goog-gke-volume": "",
"labels.goog-k8s-cluster-location": "us-west1",
"labels.goog-k8s-cluster-name": "data-infra-apps",
"labels.goog-k8s-node-pool-name": "jupyterhub-users",
"last_attach_timestamp": "2025-02-08T03:11:18.195-08:00",
"last_detach_timestamp": "",
"name": "gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"physical_block_size_bytes": "4096",
"project": "cal-itp-data-infra",
"provisioned_iops": "0",
"self_link": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"size": "100",
"snapshot": "",
"source_disk": "",
"source_disk_id": "",
"source_image_encryption_key.#": "0",
"source_image_id": "7941437431545325472",
"source_snapshot_encryption_key.#": "0",
"source_snapshot_id": "",
"type": "pd-standard",
"users.#": "1",
"users.0": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b",
"zone": "us-west1-c"
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "google_compute_disk",
Expand Down Expand Up @@ -3369,52 +3313,6 @@
}
]
},
{
"mode": "managed",
"type": "google_compute_disk",
"name": "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
"instances": [
{
"schema_version": 0,
"attributes_flat": {
"creation_timestamp": "2025-02-08T03:08:52.381-08:00",
"description": "",
"disk_encryption_key.#": "0",
"id": "us-west1-c/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"image": "https://www.googleapis.com/compute/v1/projects/gke-node-images/global/images/gke-1308-gke1128001-cos-113-18244-236-70-c-cgpv1-pre",
"label_fingerprint": "xqr1XRsDpKE=",
"labels.%": "6",
"labels.goog-gke-cluster-id-base32": "b7q6s5ghvzbrxcigz62lkdgeeggldd76ipme2xfbzcvpmcrghpqq",
"labels.goog-gke-node": "",
"labels.goog-gke-volume": "",
"labels.goog-k8s-cluster-location": "us-west1",
"labels.goog-k8s-cluster-name": "data-infra-apps",
"labels.goog-k8s-node-pool-name": "jupyterhub-users",
"last_attach_timestamp": "2025-02-08T03:08:53.433-08:00",
"last_detach_timestamp": "",
"name": "gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"physical_block_size_bytes": "4096",
"project": "cal-itp-data-infra",
"provisioned_iops": "0",
"self_link": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/disks/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"size": "100",
"snapshot": "",
"source_disk": "",
"source_disk_id": "",
"source_image_encryption_key.#": "0",
"source_image_id": "7941437431545325472",
"source_snapshot_encryption_key.#": "0",
"source_snapshot_id": "",
"type": "pd-standard",
"users.#": "1",
"users.0": "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr",
"zone": "us-west1-c"
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "google_compute_disk",
Expand Down
8 changes: 0 additions & 8 deletions iac/cal-itp-data-infra/gke/us/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ data "terraform_remote_state" "networks" {
path = "../../networks/us/terraform.tfstate"
}
}

data "terraform_remote_state" "subnetworks" {
backend = "local"

config = {
path = "../../subnetworks/us/terraform.tfstate"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ resource "google_compute_instance_group_manager" "tfer--gke-data-infra-apps-jupy
list_managed_instances_results = "PAGINATED"
name = "gke-data-infra-apps-jupyterhub-users-6aa76dbb-grp"
project = "cal-itp-data-infra"
target_size = "3"
target_size = "4"
wait_for_instances = "false"

update_policy {
Expand All @@ -249,7 +249,7 @@ resource "google_compute_instance_group_manager" "tfer--gke-data-infra-apps-jupy
list_managed_instances_results = "PAGELESS"
name = "gke-data-infra-apps-jupyterhub-users-b57e08f4-grp"
project = "cal-itp-data-infra"
target_size = "2"
target_size = "1"
wait_for_instances = "false"

update_policy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ resource "google_compute_instance_group" "tfer--us-west1-c-002F-gke-data-infra-a

resource "google_compute_instance_group" "tfer--us-west1-c-002F-gke-data-infra-apps-jupyterhub-users-6aa76dbb-grp" {
description = "This instance group is controlled by Instance Group Manager 'gke-data-infra-apps-jupyterhub-users-6aa76dbb-grp'. To modify instances in this group, use the Instance Group Manager API: https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers"
instances = ["https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-b03b", "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x", "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-juyr"]
instances = ["https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-fk7x", "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-l27c", "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-lvk6", "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/zones/us-west1-c/instances/gke-data-infra-apps-jupyterhub-users-6aa76dbb-rsbd"]
name = "gke-data-infra-apps-jupyterhub-users-6aa76dbb-grp"
network = "https://www.googleapis.com/compute/v1/projects/cal-itp-data-infra/global/networks/default"
project = "cal-itp-data-infra"
Expand Down

0 comments on commit 8ddc37e

Please sign in to comment.