Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential fix for a crash in google_storage_bucket when providers upgrade to 4.42.0 #12922

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6758.txt
@@ -0,0 +1,3 @@
```release-note:bug
storage: fixed a crash in `google_storage_bucket` when upgrading provider to version `4.42.0` with `lifecycle_rule.condition.age` unset
```
4 changes: 3 additions & 1 deletion google/resource_storage_bucket.go
Expand Up @@ -1080,7 +1080,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),
Expand All @@ -1091,6 +1090,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 {
Expand Down