From 2d1bbeee9be4aa9f319cae0eed5f6f8d68566604 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 19 Mar 2024 15:56:30 -0700 Subject: [PATCH 1/2] Add lifecycle rules to clean up mobu git-lfs artifacts --- .../data-curation/env/production.tfvars | 2 +- environment/deployments/data-curation/main.tf | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/environment/deployments/data-curation/env/production.tfvars b/environment/deployments/data-curation/env/production.tfvars index 61031bf8..3e6be2f4 100644 --- a/environment/deployments/data-curation/env/production.tfvars +++ b/environment/deployments/data-curation/env/production.tfvars @@ -91,4 +91,4 @@ git_lfs_ro_dev_service_accounts = [ ] # Increase this number to force Terraform to update the production environment. -# Serial: 5 +# Serial: 6 diff --git a/environment/deployments/data-curation/main.tf b/environment/deployments/data-curation/main.tf index 803f18ec..abc5b0e8 100644 --- a/environment/deployments/data-curation/main.tf +++ b/environment/deployments/data-curation/main.tf @@ -185,6 +185,17 @@ module "storage_bucket_5" { environment = var.environment application = "giftless" } + lifecycle_rules = [ + { + action = { + type = "Delete" + } + condition = { + matches_prefix = "mobu/git-lfs-test/" + age = 1 + } + } + ] } // RO storage access to Git-LFS bucket resource "google_storage_bucket_iam_binding" "git-lfs-bucket-ro-iam-binding" { @@ -217,6 +228,17 @@ module "storage_bucket_6" { environment = var.environment application = "giftless" } + lifecycle_rules = [ + { + action = { + type = "Delete" + } + condition = { + matches_prefix = "mobu/git-lfs-test/" + age = 1 + } + } + ] } // RO storage access to Git-LFS Dev bucket resource "google_storage_bucket_iam_binding" "git-lfs-bucket-dev-ro-iam-binding" { @@ -286,7 +308,7 @@ resource "google_storage_bucket_iam_member" "data_curation_prod_rw_panda_dev" { role = each.value member = "serviceAccount:${module.data_curation_prod_accounts.email}" } -// RW storage access to repo-locations Butler bucket +// RW storage access to repo-locations Butler bucket resource "google_storage_bucket_iam_member" "data_curation_prod_rw_repo_locations" { for_each = toset(["roles/storage.objectAdmin", "roles/storage.legacyBucketReader"]) bucket = "butler-us-central1-repo-locations" From b290ac837d17706bbcc47f9ec0ba0eca7f314f89 Mon Sep 17 00:00:00 2001 From: dspeck1 Date: Wed, 20 Mar 2024 18:28:46 +0000 Subject: [PATCH 2/2] Update min google backend version to support GCS lifecycle prefix matching rules. --- environment/deployments/data-curation/backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment/deployments/data-curation/backend.tf b/environment/deployments/data-curation/backend.tf index 281f60e4..36376b52 100644 --- a/environment/deployments/data-curation/backend.tf +++ b/environment/deployments/data-curation/backend.tf @@ -5,7 +5,7 @@ terraform { backend "gcs" {} required_providers { - google = "~> 3.1" - google-beta = "~> 3.1" + google = "~> 5.1" + google-beta = "~> 5.1" } } \ No newline at end of file