@@ -113,6 +113,26 @@ This cannot be changed once the PrivateCloud is created.`,
113
113
},
114
114
},
115
115
},
116
+ "stretched_cluster_config" : {
117
+ Type : schema .TypeList ,
118
+ Optional : true ,
119
+ Description : `The stretched cluster configuration for the private cloud.` ,
120
+ MaxItems : 1 ,
121
+ Elem : & schema.Resource {
122
+ Schema : map [string ]* schema.Schema {
123
+ "preferred_location" : {
124
+ Type : schema .TypeString ,
125
+ Optional : true ,
126
+ Description : `Zone that will remain operational when connection between the two zones is lost.` ,
127
+ },
128
+ "secondary_location" : {
129
+ Type : schema .TypeString ,
130
+ Optional : true ,
131
+ Description : `Additional zone for a higher level of availability and load balancing.` ,
132
+ },
133
+ },
134
+ },
135
+ },
116
136
},
117
137
},
118
138
},
@@ -171,16 +191,6 @@ the form: projects/{project_number}/locations/{location}/vmwareEngineNetworks/{v
171
191
Optional : true ,
172
192
Description : `User-provided description for this private cloud.` ,
173
193
},
174
- "preferred_zone" : {
175
- Type : schema .TypeString ,
176
- Optional : true ,
177
- Description : `The preferred single failure domain within a region.` ,
178
- },
179
- "secondary_zone" : {
180
- Type : schema .TypeString ,
181
- Optional : true ,
182
- Description : `The secondary single failure domain within a region.` ,
183
- },
184
194
"type" : {
185
195
Type : schema .TypeString ,
186
196
Optional : true ,
@@ -332,18 +342,6 @@ func resourceVmwareenginePrivateCloudCreate(d *schema.ResourceData, meta interfa
332
342
} else if v , ok := d .GetOkExists ("type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (typeProp )) && (ok || ! reflect .DeepEqual (v , typeProp )) {
333
343
obj ["type" ] = typeProp
334
344
}
335
- preferredZoneProp , err := expandVmwareenginePrivateCloudPreferredZone (d .Get ("preferred_zone" ), d , config )
336
- if err != nil {
337
- return err
338
- } else if v , ok := d .GetOkExists ("preferred_zone" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (preferredZoneProp )) && (ok || ! reflect .DeepEqual (v , preferredZoneProp )) {
339
- obj ["preferredZone" ] = preferredZoneProp
340
- }
341
- secondaryZoneProp , err := expandVmwareenginePrivateCloudSecondaryZone (d .Get ("secondary_zone" ), d , config )
342
- if err != nil {
343
- return err
344
- } else if v , ok := d .GetOkExists ("secondary_zone" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (secondaryZoneProp )) && (ok || ! reflect .DeepEqual (v , secondaryZoneProp )) {
345
- obj ["secondaryZone" ] = secondaryZoneProp
346
- }
347
345
348
346
url , err := tpgresource .ReplaceVars (d , config , "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds?privateCloudId={{name}}" )
349
347
if err != nil {
@@ -481,12 +479,6 @@ func resourceVmwareenginePrivateCloudRead(d *schema.ResourceData, meta interface
481
479
if err := d .Set ("vcenter" , flattenVmwareenginePrivateCloudVcenter (res ["vcenter" ], d , config )); err != nil {
482
480
return fmt .Errorf ("Error reading PrivateCloud: %s" , err )
483
481
}
484
- if err := d .Set ("preferred_zone" , flattenVmwareenginePrivateCloudPreferredZone (res ["preferredZone" ], d , config )); err != nil {
485
- return fmt .Errorf ("Error reading PrivateCloud: %s" , err )
486
- }
487
- if err := d .Set ("secondary_zone" , flattenVmwareenginePrivateCloudSecondaryZone (res ["secondaryZone" ], d , config )); err != nil {
488
- return fmt .Errorf ("Error reading PrivateCloud: %s" , err )
489
- }
490
482
491
483
return nil
492
484
}
@@ -519,18 +511,6 @@ func resourceVmwareenginePrivateCloudUpdate(d *schema.ResourceData, meta interfa
519
511
} else if v , ok := d .GetOkExists ("management_cluster" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , managementClusterProp )) {
520
512
obj ["managementCluster" ] = managementClusterProp
521
513
}
522
- preferredZoneProp , err := expandVmwareenginePrivateCloudPreferredZone (d .Get ("preferred_zone" ), d , config )
523
- if err != nil {
524
- return err
525
- } else if v , ok := d .GetOkExists ("preferred_zone" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , preferredZoneProp )) {
526
- obj ["preferredZone" ] = preferredZoneProp
527
- }
528
- secondaryZoneProp , err := expandVmwareenginePrivateCloudSecondaryZone (d .Get ("secondary_zone" ), d , config )
529
- if err != nil {
530
- return err
531
- } else if v , ok := d .GetOkExists ("secondary_zone" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , secondaryZoneProp )) {
532
- obj ["secondaryZone" ] = secondaryZoneProp
533
- }
534
514
535
515
obj , err = resourceVmwareenginePrivateCloudUpdateEncoder (d , meta , obj )
536
516
if err != nil {
@@ -828,6 +808,8 @@ func flattenVmwareenginePrivateCloudManagementCluster(v interface{}, d *schema.R
828
808
flattenVmwareenginePrivateCloudManagementClusterClusterId (original ["clusterId" ], d , config )
829
809
transformed ["node_type_configs" ] =
830
810
flattenVmwareenginePrivateCloudManagementClusterNodeTypeConfigs (original ["nodeTypeConfigs" ], d , config )
811
+ transformed ["stretched_cluster_config" ] =
812
+ flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfig (original ["stretchedClusterConfig" ], d , config )
831
813
return []interface {}{transformed }
832
814
}
833
815
func flattenVmwareenginePrivateCloudManagementClusterClusterId (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -884,6 +866,29 @@ func flattenVmwareenginePrivateCloudManagementClusterNodeTypeConfigsCustomCoreCo
884
866
return v // let terraform core handle it otherwise
885
867
}
886
868
869
+ func flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfig (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
870
+ if v == nil {
871
+ return nil
872
+ }
873
+ original := v .(map [string ]interface {})
874
+ if len (original ) == 0 {
875
+ return nil
876
+ }
877
+ transformed := make (map [string ]interface {})
878
+ transformed ["preferred_location" ] =
879
+ flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfigPreferredLocation (original ["preferredLocation" ], d , config )
880
+ transformed ["secondary_location" ] =
881
+ flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfigSecondaryLocation (original ["secondaryLocation" ], d , config )
882
+ return []interface {}{transformed }
883
+ }
884
+ func flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfigPreferredLocation (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
885
+ return v
886
+ }
887
+
888
+ func flattenVmwareenginePrivateCloudManagementClusterStretchedClusterConfigSecondaryLocation (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
889
+ return v
890
+ }
891
+
887
892
func flattenVmwareenginePrivateCloudHcx (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
888
893
if v == nil {
889
894
return nil
@@ -989,14 +994,6 @@ func flattenVmwareenginePrivateCloudVcenterFqdn(v interface{}, d *schema.Resourc
989
994
return v
990
995
}
991
996
992
- func flattenVmwareenginePrivateCloudPreferredZone (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
993
- return v
994
- }
995
-
996
- func flattenVmwareenginePrivateCloudSecondaryZone (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
997
- return v
998
- }
999
-
1000
997
func expandVmwareenginePrivateCloudDescription (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1001
998
return v , nil
1002
999
}
@@ -1091,6 +1088,13 @@ func expandVmwareenginePrivateCloudManagementCluster(v interface{}, d tpgresourc
1091
1088
transformed ["nodeTypeConfigs" ] = transformedNodeTypeConfigs
1092
1089
}
1093
1090
1091
+ transformedStretchedClusterConfig , err := expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfig (original ["stretched_cluster_config" ], d , config )
1092
+ if err != nil {
1093
+ return nil , err
1094
+ } else if val := reflect .ValueOf (transformedStretchedClusterConfig ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1095
+ transformed ["stretchedClusterConfig" ] = transformedStretchedClusterConfig
1096
+ }
1097
+
1094
1098
return transformed , nil
1095
1099
}
1096
1100
@@ -1138,15 +1142,41 @@ func expandVmwareenginePrivateCloudManagementClusterNodeTypeConfigsCustomCoreCou
1138
1142
return v , nil
1139
1143
}
1140
1144
1141
- func expandVmwareenginePrivateCloudType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1145
+ func expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfig (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1146
+ l := v .([]interface {})
1147
+ if len (l ) == 0 || l [0 ] == nil {
1148
+ return nil , nil
1149
+ }
1150
+ raw := l [0 ]
1151
+ original := raw .(map [string ]interface {})
1152
+ transformed := make (map [string ]interface {})
1153
+
1154
+ transformedPreferredLocation , err := expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfigPreferredLocation (original ["preferred_location" ], d , config )
1155
+ if err != nil {
1156
+ return nil , err
1157
+ } else if val := reflect .ValueOf (transformedPreferredLocation ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1158
+ transformed ["preferredLocation" ] = transformedPreferredLocation
1159
+ }
1160
+
1161
+ transformedSecondaryLocation , err := expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfigSecondaryLocation (original ["secondary_location" ], d , config )
1162
+ if err != nil {
1163
+ return nil , err
1164
+ } else if val := reflect .ValueOf (transformedSecondaryLocation ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1165
+ transformed ["secondaryLocation" ] = transformedSecondaryLocation
1166
+ }
1167
+
1168
+ return transformed , nil
1169
+ }
1170
+
1171
+ func expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfigPreferredLocation (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1142
1172
return v , nil
1143
1173
}
1144
1174
1145
- func expandVmwareenginePrivateCloudPreferredZone (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1175
+ func expandVmwareenginePrivateCloudManagementClusterStretchedClusterConfigSecondaryLocation (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1146
1176
return v , nil
1147
1177
}
1148
1178
1149
- func expandVmwareenginePrivateCloudSecondaryZone (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1179
+ func expandVmwareenginePrivateCloudType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1150
1180
return v , nil
1151
1181
}
1152
1182
0 commit comments