@@ -47,7 +47,12 @@ func resourceScalewayIamPolicy() *schema.Resource {
47
47
Computed : true ,
48
48
Description : "Whether or not the policy is editable." ,
49
49
},
50
- "organization_id" : organizationIDSchema (),
50
+ "organization_id" : {
51
+ Type : schema .TypeString ,
52
+ Optional : true ,
53
+ Computed : true ,
54
+ Description : "ID of organization the policy is linked to." ,
55
+ },
51
56
"user_id" : {
52
57
Type : schema .TypeString ,
53
58
Optional : true ,
@@ -109,14 +114,16 @@ func resourceScalewayIamPolicy() *schema.Resource {
109
114
110
115
func resourceScalewayIamPolicyCreate (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
111
116
api := iamAPI (meta )
117
+
112
118
pol , err := api .CreatePolicy (& iam.CreatePolicyRequest {
113
- Name : expandOrGenerateString (d .Get ("name" ), "policy-" ),
114
- Description : d .Get ("description" ).(string ),
115
- Rules : expandPolicyRuleSpecs (d .Get ("rule" )),
116
- UserID : expandStringPtr (d .Get ("user_id" )),
117
- GroupID : expandStringPtr (d .Get ("group_id" )),
118
- ApplicationID : expandStringPtr (d .Get ("application_id" )),
119
- NoPrincipal : expandBoolPtr (d .Get ("no_principal" )),
119
+ Name : expandOrGenerateString (d .Get ("name" ), "policy-" ),
120
+ Description : d .Get ("description" ).(string ),
121
+ Rules : expandPolicyRuleSpecs (d .Get ("rule" )),
122
+ UserID : expandStringPtr (d .Get ("user_id" )),
123
+ GroupID : expandStringPtr (d .Get ("group_id" )),
124
+ ApplicationID : expandStringPtr (d .Get ("application_id" )),
125
+ NoPrincipal : expandBoolPtr (d .Get ("no_principal" )),
126
+ OrganizationID : d .Get ("organization_id" ).(string ),
120
127
}, scw .WithContext (ctx ))
121
128
if err != nil {
122
129
return diag .FromErr (err )
0 commit comments