Skip to content

Commit 935f42c

Browse files
heinymorgante
authored andcommitted
fix: Fix deprecation of is_live lifecycle rule (#91)
1 parent fa2ee63 commit 935f42c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

main.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ resource "google_storage_bucket" "buckets" {
9494
condition {
9595
age = lookup(lifecycle_rule.value.condition, "age", null)
9696
created_before = lookup(lifecycle_rule.value.condition, "created_before", null)
97-
with_state = lookup(lifecycle_rule.value.condition, "with_state", null)
98-
is_live = lookup(lifecycle_rule.value.condition, "is_live", null)
97+
with_state = lookup(lifecycle_rule.value.condition, "with_state", lookup(lifecycle_rule.value.condition, "is_live", false) ? "LIVE" : null)
9998
matches_storage_class = contains(keys(lifecycle_rule.value.condition), "matches_storage_class") ? split(",", lifecycle_rule.value.condition["matches_storage_class"]) : null
10099
num_newer_versions = lookup(lifecycle_rule.value.condition, "num_newer_versions", null)
101100
}

modules/simple_bucket/main.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ resource "google_storage_bucket" "bucket" {
5252
condition {
5353
age = lookup(lifecycle_rule.value.condition, "age", null)
5454
created_before = lookup(lifecycle_rule.value.condition, "created_before", null)
55-
is_live = lookup(lifecycle_rule.value.condition, "is_live", null)
56-
with_state = lookup(lifecycle_rule.value.condition, "with_state", null)
55+
with_state = lookup(lifecycle_rule.value.condition, "with_state", lookup(lifecycle_rule.value.condition, "is_live", false) ? "LIVE" : null)
5756
matches_storage_class = lookup(lifecycle_rule.value.condition, "matches_storage_class", null)
5857
num_newer_versions = lookup(lifecycle_rule.value.condition, "num_newer_versions", null)
5958
}

0 commit comments

Comments
 (0)