|
4 | 4 | "github.com/hashicorp/terraform-plugin-sdk/helper/schema" |
5 | 5 | "github.com/hashicorp/terraform-plugin-sdk/helper/validation" |
6 | 6 | "github.com/scaleway/scaleway-sdk-go/api/instance/v1" |
| 7 | + "github.com/scaleway/scaleway-sdk-go/scw" |
7 | 8 | ) |
8 | 9 |
|
9 | 10 | func resourceScalewayInstancePlacementGroup() *schema.Resource { |
@@ -63,7 +64,7 @@ func resourceScalewayInstancePlacementGroupCreate(d *schema.ResourceData, m inte |
63 | 64 | res, err := instanceApi.CreatePlacementGroup(&instance.CreatePlacementGroupRequest{ |
64 | 65 | Zone: zone, |
65 | 66 | Name: expandOrGenerateString(d.Get("name"), "pg"), |
66 | | - Organization: d.Get("organization_id").(string), |
| 67 | + Organization: scw.StringPtr(d.Get("organization_id").(string)), |
67 | 68 | PolicyMode: instance.PlacementGroupPolicyMode(d.Get("policy_mode").(string)), |
68 | 69 | PolicyType: instance.PlacementGroupPolicyType(d.Get("policy_type").(string)), |
69 | 70 | }) |
@@ -109,11 +110,13 @@ func resourceScalewayInstancePlacementGroupUpdate(d *schema.ResourceData, m inte |
109 | 110 | if err != nil { |
110 | 111 | return err |
111 | 112 | } |
| 113 | + policyMode := instance.PlacementGroupPolicyMode(d.Get("policy_mode").(string)) |
| 114 | + policyType := instance.PlacementGroupPolicyType(d.Get("policy_type").(string)) |
112 | 115 | req := &instance.UpdatePlacementGroupRequest{ |
113 | 116 | Zone: zone, |
114 | 117 | PlacementGroupID: ID, |
115 | | - PolicyMode: instance.PlacementGroupPolicyMode(d.Get("policy_mode").(string)), |
116 | | - PolicyType: instance.PlacementGroupPolicyType(d.Get("policy_type").(string)), |
| 118 | + PolicyMode: &policyMode, |
| 119 | + PolicyType: &policyType, |
117 | 120 | } |
118 | 121 |
|
119 | 122 | hasChanged := d.HasChange("policy_mode") || d.HasChange("policy_type") |
|
0 commit comments