diff --git a/deploy.sh b/deploy.sh index 5df63167..bc37699f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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" diff --git a/src/bootstrap/cloud/terraform/gcs.tf b/src/bootstrap/cloud/terraform/gcs.tf index 65531b60..53153e25 100644 --- a/src/bootstrap/cloud/terraform/gcs.tf +++ b/src/bootstrap/cloud/terraform/gcs.tf @@ -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" +}