Skip to content

Commit 1bb04b6

Browse files
Fixes storage bucket custom_time_before/noncurrent_time_before update issue (#10601) (#18127)
[upstream:2250d3049c8ec081c0b7dc378615c32dd74704bb] Signed-off-by: Modular Magician <[email protected]>
1 parent e550515 commit 1bb04b6

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

google/services/storage/resource_storage_bucket.go

+8
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,14 @@ func resourceGCSBucketLifecycleRuleConditionHash(v interface{}) int {
16411641
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
16421642
}
16431643

1644+
if v, ok := m["custom_time_before"]; ok {
1645+
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
1646+
}
1647+
1648+
if v, ok := m["noncurrent_time_before"]; ok {
1649+
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
1650+
}
1651+
16441652
withStateV, withStateOk := m["with_state"]
16451653
if withStateOk {
16461654
switch withStateV.(string) {

google/services/storage/resource_storage_bucket_test.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,14 @@ resource "google_storage_bucket" "bucket" {
19561956
custom_time_before = "2019-01-01"
19571957
}
19581958
}
1959+
lifecycle_rule {
1960+
action {
1961+
type = "Delete"
1962+
}
1963+
condition {
1964+
noncurrent_time_before = "2019-01-01"
1965+
}
1966+
}
19591967
lifecycle_rule {
19601968
action {
19611969
type = "SetStorageClass"
@@ -2044,7 +2052,15 @@ resource "google_storage_bucket" "bucket" {
20442052
type = "Delete"
20452053
}
20462054
condition {
2047-
custom_time_before = "2019-01-01"
2055+
custom_time_before = "2019-01-12"
2056+
}
2057+
}
2058+
lifecycle_rule {
2059+
action {
2060+
type = "Delete"
2061+
}
2062+
condition {
2063+
noncurrent_time_before = "2019-01-12"
20482064
}
20492065
}
20502066
lifecycle_rule {

0 commit comments

Comments
 (0)