@@ -53,41 +53,6 @@ first character must be a lowercase letter, and all following characters
5353must be a dash, lowercase letter, or digit, except the last character,
5454which cannot be a dash.` ,
5555 },
56- "group_placement_policy" : {
57- Type : schema .TypeList ,
58- Optional : true ,
59- ForceNew : true ,
60- Description : `Policy for creating snapshots of persistent disks.` ,
61- MaxItems : 1 ,
62- Elem : & schema.Resource {
63- Schema : map [string ]* schema.Schema {
64- "availability_domain_count" : {
65- Type : schema .TypeInt ,
66- Optional : true ,
67- ForceNew : true ,
68- Description : `The number of availability domains instances will be spread across. If two instances are in different
69- availability domain, they will not be put in the same low latency network` ,
70- AtLeastOneOf : []string {"group_placement_policy.0.vm_count" , "group_placement_policy.0.availability_domain_count" },
71- },
72- "collocation" : {
73- Type : schema .TypeString ,
74- Optional : true ,
75- ForceNew : true ,
76- ValidateFunc : validation .StringInSlice ([]string {"COLLOCATED" , "" }, false ),
77- Description : `Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
78- Specify 'COLLOCATED' to enable collocation. Can only be specified with 'vm_count'.` ,
79- },
80- "vm_count" : {
81- Type : schema .TypeInt ,
82- Optional : true ,
83- ForceNew : true ,
84- Description : `Number of vms in this placement group` ,
85- AtLeastOneOf : []string {"group_placement_policy.0.vm_count" , "group_placement_policy.0.availability_domain_count" },
86- },
87- },
88- },
89- ConflictsWith : []string {"snapshot_schedule_policy" },
90- },
9156 "region" : {
9257 Type : schema .TypeString ,
9358 Computed : true ,
@@ -260,7 +225,6 @@ Valid options are KEEP_AUTO_SNAPSHOTS and APPLY_RETENTION_POLICY`,
260225 },
261226 },
262227 },
263- ConflictsWith : []string {"group_placement_policy" },
264228 },
265229 "project" : {
266230 Type : schema .TypeString ,
@@ -313,12 +277,6 @@ func resourceComputeResourcePolicyCreate(d *schema.ResourceData, meta interface{
313277 } else if v , ok := d .GetOkExists ("snapshot_schedule_policy" ); ! isEmptyValue (reflect .ValueOf (snapshotSchedulePolicyProp )) && (ok || ! reflect .DeepEqual (v , snapshotSchedulePolicyProp )) {
314278 obj ["snapshotSchedulePolicy" ] = snapshotSchedulePolicyProp
315279 }
316- groupPlacementPolicyProp , err := expandComputeResourcePolicyGroupPlacementPolicy (d .Get ("group_placement_policy" ), d , config )
317- if err != nil {
318- return err
319- } else if v , ok := d .GetOkExists ("group_placement_policy" ); ! isEmptyValue (reflect .ValueOf (groupPlacementPolicyProp )) && (ok || ! reflect .DeepEqual (v , groupPlacementPolicyProp )) {
320- obj ["groupPlacementPolicy" ] = groupPlacementPolicyProp
321- }
322280 regionProp , err := expandComputeResourcePolicyRegion (d .Get ("region" ), d , config )
323281 if err != nil {
324282 return err
@@ -390,9 +348,6 @@ func resourceComputeResourcePolicyRead(d *schema.ResourceData, meta interface{})
390348 if err := d .Set ("snapshot_schedule_policy" , flattenComputeResourcePolicySnapshotSchedulePolicy (res ["snapshotSchedulePolicy" ], d , config )); err != nil {
391349 return fmt .Errorf ("Error reading ResourcePolicy: %s" , err )
392350 }
393- if err := d .Set ("group_placement_policy" , flattenComputeResourcePolicyGroupPlacementPolicy (res ["groupPlacementPolicy" ], d , config )); err != nil {
394- return fmt .Errorf ("Error reading ResourcePolicy: %s" , err )
395- }
396351 if err := d .Set ("region" , flattenComputeResourcePolicyRegion (res ["region" ], d , config )); err != nil {
397352 return fmt .Errorf ("Error reading ResourcePolicy: %s" , err )
398353 }
@@ -654,47 +609,6 @@ func flattenComputeResourcePolicySnapshotSchedulePolicySnapshotPropertiesGuestFl
654609 return v
655610}
656611
657- func flattenComputeResourcePolicyGroupPlacementPolicy (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
658- if v == nil {
659- return nil
660- }
661- original := v .(map [string ]interface {})
662- if len (original ) == 0 {
663- return nil
664- }
665- transformed := make (map [string ]interface {})
666- transformed ["vm_count" ] =
667- flattenComputeResourcePolicyGroupPlacementPolicyVmCount (original ["vmCount" ], d , config )
668- transformed ["availability_domain_count" ] =
669- flattenComputeResourcePolicyGroupPlacementPolicyAvailabilityDomainCount (original ["availabilityDomainCount" ], d , config )
670- transformed ["collocation" ] =
671- flattenComputeResourcePolicyGroupPlacementPolicyCollocation (original ["collocation" ], d , config )
672- return []interface {}{transformed }
673- }
674- func flattenComputeResourcePolicyGroupPlacementPolicyVmCount (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
675- // Handles the string fixed64 format
676- if strVal , ok := v .(string ); ok {
677- if intVal , err := strconv .ParseInt (strVal , 10 , 64 ); err == nil {
678- return intVal
679- } // let terraform core handle it if we can't convert the string to an int.
680- }
681- return v
682- }
683-
684- func flattenComputeResourcePolicyGroupPlacementPolicyAvailabilityDomainCount (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
685- // Handles the string fixed64 format
686- if strVal , ok := v .(string ); ok {
687- if intVal , err := strconv .ParseInt (strVal , 10 , 64 ); err == nil {
688- return intVal
689- } // let terraform core handle it if we can't convert the string to an int.
690- }
691- return v
692- }
693-
694- func flattenComputeResourcePolicyGroupPlacementPolicyCollocation (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
695- return v
696- }
697-
698612func flattenComputeResourcePolicyRegion (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
699613 if v == nil {
700614 return v
@@ -984,51 +898,6 @@ func expandComputeResourcePolicySnapshotSchedulePolicySnapshotPropertiesGuestFlu
984898 return v , nil
985899}
986900
987- func expandComputeResourcePolicyGroupPlacementPolicy (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
988- l := v .([]interface {})
989- if len (l ) == 0 || l [0 ] == nil {
990- return nil , nil
991- }
992- raw := l [0 ]
993- original := raw .(map [string ]interface {})
994- transformed := make (map [string ]interface {})
995-
996- transformedVmCount , err := expandComputeResourcePolicyGroupPlacementPolicyVmCount (original ["vm_count" ], d , config )
997- if err != nil {
998- return nil , err
999- } else if val := reflect .ValueOf (transformedVmCount ); val .IsValid () && ! isEmptyValue (val ) {
1000- transformed ["vmCount" ] = transformedVmCount
1001- }
1002-
1003- transformedAvailabilityDomainCount , err := expandComputeResourcePolicyGroupPlacementPolicyAvailabilityDomainCount (original ["availability_domain_count" ], d , config )
1004- if err != nil {
1005- return nil , err
1006- } else if val := reflect .ValueOf (transformedAvailabilityDomainCount ); val .IsValid () && ! isEmptyValue (val ) {
1007- transformed ["availabilityDomainCount" ] = transformedAvailabilityDomainCount
1008- }
1009-
1010- transformedCollocation , err := expandComputeResourcePolicyGroupPlacementPolicyCollocation (original ["collocation" ], d , config )
1011- if err != nil {
1012- return nil , err
1013- } else if val := reflect .ValueOf (transformedCollocation ); val .IsValid () && ! isEmptyValue (val ) {
1014- transformed ["collocation" ] = transformedCollocation
1015- }
1016-
1017- return transformed , nil
1018- }
1019-
1020- func expandComputeResourcePolicyGroupPlacementPolicyVmCount (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1021- return v , nil
1022- }
1023-
1024- func expandComputeResourcePolicyGroupPlacementPolicyAvailabilityDomainCount (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1025- return v , nil
1026- }
1027-
1028- func expandComputeResourcePolicyGroupPlacementPolicyCollocation (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1029- return v , nil
1030- }
1031-
1032901func expandComputeResourcePolicyRegion (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1033902 f , err := parseGlobalFieldValue ("regions" , v .(string ), "project" , d , config , true )
1034903 if err != nil {
0 commit comments