Skip to content

Commit c4a199d

Browse files
authored
add handling of empty versioning and cors in hand written storage bucket (#4608)
1 parent c9d3ac0 commit c4a199d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mmv1/third_party/validator/storage_bucket.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ func GetStorageBucketApiObject(d TerraformResourceData, config *Config) (map[str
107107
}
108108

109109
func expandCors(configured []interface{}) []*storage.BucketCors {
110+
if len(configured) == 0 || configured[0] == nil {
111+
return nil
112+
}
110113
corsRules := make([]*storage.BucketCors, 0, len(configured))
111114
for _, raw := range configured {
112115
data := raw.(map[string]interface{})
@@ -156,7 +159,7 @@ func expandBucketLogging(configured interface{}) *storage.BucketLogging {
156159

157160
func expandBucketVersioning(configured interface{}) *storage.BucketVersioning {
158161
versionings := configured.([]interface{})
159-
if len(versionings) == 0 {
162+
if len(versionings) == 0 || versionings[0] == nil {
160163
return nil
161164
}
162165

0 commit comments

Comments
 (0)