@@ -82,6 +82,12 @@ Specify 'COLLOCATED' to enable collocation. Can only be specified with 'vm_count
8282with a COLLOCATED policy, then exactly 'vm_count' instances must be created at the same time with the resource policy
8383attached. Possible values: ["COLLOCATED"]` ,
8484 },
85+ "max_distance" : {
86+ Type : schema .TypeInt ,
87+ Optional : true ,
88+ ForceNew : true ,
89+ Description : `Specifies the number of max logical switches.` ,
90+ },
8591 "vm_count" : {
8692 Type : schema .TypeInt ,
8793 Optional : true ,
@@ -837,6 +843,8 @@ func flattenComputeResourcePolicyGroupPlacementPolicy(v interface{}, d *schema.R
837843 flattenComputeResourcePolicyGroupPlacementPolicyAvailabilityDomainCount (original ["availabilityDomainCount" ], d , config )
838844 transformed ["collocation" ] =
839845 flattenComputeResourcePolicyGroupPlacementPolicyCollocation (original ["collocation" ], d , config )
846+ transformed ["max_distance" ] =
847+ flattenComputeResourcePolicyGroupPlacementPolicyMaxDistance (original ["maxDistance" ], d , config )
840848 return []interface {}{transformed }
841849}
842850func flattenComputeResourcePolicyGroupPlacementPolicyVmCount (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
@@ -877,6 +885,23 @@ func flattenComputeResourcePolicyGroupPlacementPolicyCollocation(v interface{},
877885 return v
878886}
879887
888+ func flattenComputeResourcePolicyGroupPlacementPolicyMaxDistance (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
889+ // Handles the string fixed64 format
890+ if strVal , ok := v .(string ); ok {
891+ if intVal , err := stringToFixed64 (strVal ); err == nil {
892+ return intVal
893+ }
894+ }
895+
896+ // number values are represented as float64
897+ if floatVal , ok := v .(float64 ); ok {
898+ intVal := int (floatVal )
899+ return intVal
900+ }
901+
902+ return v // let terraform core handle it otherwise
903+ }
904+
880905func flattenComputeResourcePolicyInstanceSchedulePolicy (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
881906 if v == nil {
882907 return nil
@@ -1278,6 +1303,13 @@ func expandComputeResourcePolicyGroupPlacementPolicy(v interface{}, d TerraformR
12781303 transformed ["collocation" ] = transformedCollocation
12791304 }
12801305
1306+ transformedMaxDistance , err := expandComputeResourcePolicyGroupPlacementPolicyMaxDistance (original ["max_distance" ], d , config )
1307+ if err != nil {
1308+ return nil , err
1309+ } else if val := reflect .ValueOf (transformedMaxDistance ); val .IsValid () && ! isEmptyValue (val ) {
1310+ transformed ["maxDistance" ] = transformedMaxDistance
1311+ }
1312+
12811313 return transformed , nil
12821314}
12831315
@@ -1293,6 +1325,10 @@ func expandComputeResourcePolicyGroupPlacementPolicyCollocation(v interface{}, d
12931325 return v , nil
12941326}
12951327
1328+ func expandComputeResourcePolicyGroupPlacementPolicyMaxDistance (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1329+ return v , nil
1330+ }
1331+
12961332func expandComputeResourcePolicyInstanceSchedulePolicy (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
12971333 l := v .([]interface {})
12981334 if len (l ) == 0 || l [0 ] == nil {
0 commit comments