Skip to content

Commit ae8bae9

Browse files
modular-magicianrileykarson
authored andcommitted
Fix empty TypeList expands in generated resources (#2233)
<!-- This change is generated by MagicModules. --> /cc @rileykarson
1 parent 5d5c1b7 commit ae8bae9

10 files changed

+25
-25
lines changed

google/resource_binaryauthorization_attestor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func expandBinaryAuthorizationAttestorDescription(v interface{}, d *schema.Resou
317317

318318
func expandBinaryAuthorizationAttestorAttestationAuthorityNote(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
319319
l := v.([]interface{})
320-
if len(l) == 0 {
320+
if len(l) == 0 || l[0] == nil {
321321
return nil, nil
322322
}
323323
raw := l[0]

google/resource_binaryauthorization_policy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func expandBinaryAuthorizationPolicyClusterAdmissionRulesEnforcementMode(v inter
503503

504504
func expandBinaryAuthorizationPolicyDefaultAdmissionRule(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
505505
l := v.([]interface{})
506-
if len(l) == 0 {
506+
if len(l) == 0 || l[0] == nil {
507507
return nil, nil
508508
}
509509
raw := l[0]

google/resource_compute_autoscaler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ func expandComputeAutoscalerDescription(v interface{}, d *schema.ResourceData, c
538538

539539
func expandComputeAutoscalerAutoscalingPolicy(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
540540
l := v.([]interface{})
541-
if len(l) == 0 {
541+
if len(l) == 0 || l[0] == nil {
542542
return nil, nil
543543
}
544544
raw := l[0]
@@ -604,7 +604,7 @@ func expandComputeAutoscalerAutoscalingPolicyCooldownPeriod(v interface{}, d *sc
604604

605605
func expandComputeAutoscalerAutoscalingPolicyCpuUtilization(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
606606
l := v.([]interface{})
607-
if len(l) == 0 {
607+
if len(l) == 0 || l[0] == nil {
608608
return nil, nil
609609
}
610610
raw := l[0]
@@ -675,7 +675,7 @@ func expandComputeAutoscalerAutoscalingPolicyMetricType(v interface{}, d *schema
675675

676676
func expandComputeAutoscalerAutoscalingPolicyLoadBalancingUtilization(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
677677
l := v.([]interface{})
678-
if len(l) == 0 {
678+
if len(l) == 0 || l[0] == nil {
679679
return nil, nil
680680
}
681681
raw := l[0]

google/resource_compute_disk.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ func expandComputeDiskZone(v interface{}, d *schema.ResourceData, config *Config
10051005

10061006
func expandComputeDiskSourceImageEncryptionKey(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
10071007
l := v.([]interface{})
1008-
if len(l) == 0 {
1008+
if len(l) == 0 || l[0] == nil {
10091009
return nil, nil
10101010
}
10111011
raw := l[0]
@@ -1039,7 +1039,7 @@ func expandComputeDiskSourceImageEncryptionKeySha256(v interface{}, d *schema.Re
10391039

10401040
func expandComputeDiskDiskEncryptionKey(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
10411041
l := v.([]interface{})
1042-
if len(l) == 0 {
1042+
if len(l) == 0 || l[0] == nil {
10431043
return nil, nil
10441044
}
10451045
raw := l[0]
@@ -1081,7 +1081,7 @@ func expandComputeDiskSnapshot(v interface{}, d *schema.ResourceData, config *Co
10811081

10821082
func expandComputeDiskSourceSnapshotEncryptionKey(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
10831083
l := v.([]interface{})
1084-
if len(l) == 0 {
1084+
if len(l) == 0 || l[0] == nil {
10851085
return nil, nil
10861086
}
10871087
raw := l[0]

google/resource_compute_health_check.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ func expandComputeHealthCheckUnhealthyThreshold(v interface{}, d *schema.Resourc
774774

775775
func expandComputeHealthCheckHttpHealthCheck(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
776776
l := v.([]interface{})
777-
if len(l) == 0 {
777+
if len(l) == 0 || l[0] == nil {
778778
return nil, nil
779779
}
780780
raw := l[0]
@@ -830,7 +830,7 @@ func expandComputeHealthCheckHttpHealthCheckProxyHeader(v interface{}, d *schema
830830

831831
func expandComputeHealthCheckHttpsHealthCheck(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
832832
l := v.([]interface{})
833-
if len(l) == 0 {
833+
if len(l) == 0 || l[0] == nil {
834834
return nil, nil
835835
}
836836
raw := l[0]
@@ -886,7 +886,7 @@ func expandComputeHealthCheckHttpsHealthCheckProxyHeader(v interface{}, d *schem
886886

887887
func expandComputeHealthCheckTcpHealthCheck(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
888888
l := v.([]interface{})
889-
if len(l) == 0 {
889+
if len(l) == 0 || l[0] == nil {
890890
return nil, nil
891891
}
892892
raw := l[0]
@@ -942,7 +942,7 @@ func expandComputeHealthCheckTcpHealthCheckProxyHeader(v interface{}, d *schema.
942942

943943
func expandComputeHealthCheckSslHealthCheck(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
944944
l := v.([]interface{})
945-
if len(l) == 0 {
945+
if len(l) == 0 || l[0] == nil {
946946
return nil, nil
947947
}
948948
raw := l[0]

google/resource_compute_region_autoscaler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ func expandComputeRegionAutoscalerDescription(v interface{}, d *schema.ResourceD
534534

535535
func expandComputeRegionAutoscalerAutoscalingPolicy(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
536536
l := v.([]interface{})
537-
if len(l) == 0 {
537+
if len(l) == 0 || l[0] == nil {
538538
return nil, nil
539539
}
540540
raw := l[0]
@@ -600,7 +600,7 @@ func expandComputeRegionAutoscalerAutoscalingPolicyCooldownPeriod(v interface{},
600600

601601
func expandComputeRegionAutoscalerAutoscalingPolicyCpuUtilization(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
602602
l := v.([]interface{})
603-
if len(l) == 0 {
603+
if len(l) == 0 || l[0] == nil {
604604
return nil, nil
605605
}
606606
raw := l[0]
@@ -671,7 +671,7 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMetricType(v interface{}, d *
671671

672672
func expandComputeRegionAutoscalerAutoscalingPolicyLoadBalancingUtilization(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
673673
l := v.([]interface{})
674-
if len(l) == 0 {
674+
if len(l) == 0 || l[0] == nil {
675675
return nil, nil
676676
}
677677
raw := l[0]

google/resource_compute_region_disk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func expandComputeRegionDiskRegion(v interface{}, d *schema.ResourceData, config
733733

734734
func expandComputeRegionDiskDiskEncryptionKey(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
735735
l := v.([]interface{})
736-
if len(l) == 0 {
736+
if len(l) == 0 || l[0] == nil {
737737
return nil, nil
738738
}
739739
raw := l[0]
@@ -775,7 +775,7 @@ func expandComputeRegionDiskSnapshot(v interface{}, d *schema.ResourceData, conf
775775

776776
func expandComputeRegionDiskSourceSnapshotEncryptionKey(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
777777
l := v.([]interface{})
778-
if len(l) == 0 {
778+
if len(l) == 0 || l[0] == nil {
779779
return nil, nil
780780
}
781781
raw := l[0]

google/resource_compute_router.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ func expandComputeRouterNetwork(v interface{}, d *schema.ResourceData, config *C
491491

492492
func expandComputeRouterBgp(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
493493
l := v.([]interface{})
494-
if len(l) == 0 {
494+
if len(l) == 0 || l[0] == nil {
495495
return nil, nil
496496
}
497497
raw := l[0]

google/resource_containeranalysis_note.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func expandContainerAnalysisNoteName(v interface{}, d *schema.ResourceData, conf
257257

258258
func expandContainerAnalysisNoteAttestationAuthority(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
259259
l := v.([]interface{})
260-
if len(l) == 0 {
260+
if len(l) == 0 || l[0] == nil {
261261
return nil, nil
262262
}
263263
raw := l[0]
@@ -276,7 +276,7 @@ func expandContainerAnalysisNoteAttestationAuthority(v interface{}, d *schema.Re
276276

277277
func expandContainerAnalysisNoteAttestationAuthorityHint(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
278278
l := v.([]interface{})
279-
if len(l) == 0 {
279+
if len(l) == 0 || l[0] == nil {
280280
return nil, nil
281281
}
282282
raw := l[0]

google/resource_monitoring_alert_policy.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ func expandMonitoringAlertPolicyConditions(v interface{}, d *schema.ResourceData
902902

903903
func expandMonitoringAlertPolicyConditionsConditionAbsent(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
904904
l := v.([]interface{})
905-
if len(l) == 0 {
905+
if len(l) == 0 || l[0] == nil {
906906
return nil, nil
907907
}
908908
raw := l[0]
@@ -1001,7 +1001,7 @@ func expandMonitoringAlertPolicyConditionsConditionAbsentAggregationsCrossSeries
10011001

10021002
func expandMonitoringAlertPolicyConditionsConditionAbsentTrigger(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
10031003
l := v.([]interface{})
1004-
if len(l) == 0 {
1004+
if len(l) == 0 || l[0] == nil {
10051005
return nil, nil
10061006
}
10071007
raw := l[0]
@@ -1047,7 +1047,7 @@ func expandMonitoringAlertPolicyConditionsName(v interface{}, d *schema.Resource
10471047

10481048
func expandMonitoringAlertPolicyConditionsConditionThreshold(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
10491049
l := v.([]interface{})
1050-
if len(l) == 0 {
1050+
if len(l) == 0 || l[0] == nil {
10511051
return nil, nil
10521052
}
10531053
raw := l[0]
@@ -1190,7 +1190,7 @@ func expandMonitoringAlertPolicyConditionsConditionThresholdComparison(v interfa
11901190

11911191
func expandMonitoringAlertPolicyConditionsConditionThresholdTrigger(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
11921192
l := v.([]interface{})
1193-
if len(l) == 0 {
1193+
if len(l) == 0 || l[0] == nil {
11941194
return nil, nil
11951195
}
11961196
raw := l[0]
@@ -1299,7 +1299,7 @@ func expandMonitoringAlertPolicyLabels(v interface{}, d *schema.ResourceData, co
12991299

13001300
func expandMonitoringAlertPolicyDocumentation(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
13011301
l := v.([]interface{})
1302-
if len(l) == 0 {
1302+
if len(l) == 0 || l[0] == nil {
13031303
return nil, nil
13041304
}
13051305
raw := l[0]

0 commit comments

Comments
 (0)