From 13f6cd13cc9147e821c8ae9d9e486e6b74263805 Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Tue, 1 Nov 2022 11:41:29 -0700 Subject: [PATCH] potential fix for a crash in `google_storage_bucket` when providers upgrade to `4.42.0` (#6758) --- .../terraform/resources/resource_storage_bucket.go.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/resources/resource_storage_bucket.go.erb b/mmv1/third_party/terraform/resources/resource_storage_bucket.go.erb index f0ca585d04e0..0d82052e4e4c 100644 --- a/mmv1/third_party/terraform/resources/resource_storage_bucket.go.erb +++ b/mmv1/third_party/terraform/resources/resource_storage_bucket.go.erb @@ -1081,7 +1081,6 @@ func flattenBucketLifecycleRuleAction(action *storage.BucketLifecycleRuleAction) func flattenBucketLifecycleRuleCondition(condition *storage.BucketLifecycleRuleCondition) map[string]interface{} { ruleCondition := map[string]interface{}{ - "age": int(*condition.Age), "created_before": condition.CreatedBefore, "matches_storage_class": convertStringArrToInterface(condition.MatchesStorageClass), "num_newer_versions": int(condition.NumNewerVersions), @@ -1092,6 +1091,9 @@ func flattenBucketLifecycleRuleCondition(condition *storage.BucketLifecycleRuleC "matches_prefix": convertStringArrToInterface(condition.MatchesPrefix), "matches_suffix": convertStringArrToInterface(condition.MatchesSuffix), } + if condition.Age != nil { + ruleCondition["age"] = int(*condition.Age) + } if condition.IsLive == nil { ruleCondition["with_state"] = "ANY" } else {