Skip to content

Commit

Permalink
Import the config bucket and put installed version file there.
Browse files Browse the repository at this point in the history
1) We reference the config bucket from a lot of the scripts and docs. Hence
   make sure we also create it here. Use terraform import cli, since we're
   still on a too old version for using the import statement.
2) create the crc version in the config bucket, as the setup-robot is
   conditional.
  • Loading branch information
ensonic committed Dec 4, 2024
1 parent 7ec164f commit c8fc019
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ function terraform_apply {
# We've stopped managing Google Cloud projects in Terraform, make sure they
# aren't deleted.
terraform_exec state rm google_project.project 2>/dev/null || true
# We did not always create the bucket here, but sometimes elsewhere. Import it
# to consitently manage it from here now.
terraform_exec import google_storage_bucket.config_store "${GCP_PROJECT_ID}-cloud-robotics-config" 2>/dev/null || true

terraform_exec apply ${TERRAFORM_APPLY_FLAGS} \
|| die "terraform apply failed"
Expand Down
21 changes: 21 additions & 0 deletions src/bootstrap/cloud/terraform/gcs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,24 @@ resource "google_storage_bucket_object" "setup_robot" {
cache_control = "private, max-age=0, no-transform"
count = var.onprem_federation ? 1 : 0
}

# We need terraform 1.5.4 for this
# import {
# to = google_storage_bucket.config_store
# id = "${var.id}-cloud-robotics-config"
# }

resource "google_storage_bucket" "config_store" {
name = "${var.id}-cloud-robotics-config"
location = "US"
storage_class = "STANDARD"
force_destroy = true
uniform_bucket_level_access = true
}

resource "google_storage_bucket_object" "config_store_crc_version" {
name = "crc_version.txt"
content = var.crc_version
bucket = google_storage_bucket.config_store.name
cache_control = "private, max-age=0, no-transform"
}

0 comments on commit c8fc019

Please sign in to comment.