@@ -82,6 +82,11 @@ func resourceScalewayFunctionNamespaceCreate(ctx context.Context, d *schema.Reso
82
82
83
83
d .SetId (newRegionalIDString (region , ns .ID ))
84
84
85
+ _ , err = waitForFunctionNamespace (ctx , api , region , ns .ID , d .Timeout (schema .TimeoutCreate ))
86
+ if err != nil {
87
+ return diag .FromErr (err )
88
+ }
89
+
85
90
return resourceScalewayFunctionNamespaceRead (ctx , d , meta )
86
91
}
87
92
@@ -91,12 +96,7 @@ func resourceScalewayFunctionNamespaceRead(ctx context.Context, d *schema.Resour
91
96
return diag .FromErr (err )
92
97
}
93
98
94
- ns , err := api .WaitForNamespace (& function.WaitForNamespaceRequest {
95
- Region : region ,
96
- NamespaceID : id ,
97
- RetryInterval : DefaultWaitRetryInterval ,
98
- }, scw .WithContext (ctx ))
99
-
99
+ ns , err := waitForFunctionNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutRead ))
100
100
if err != nil {
101
101
if is404Error (err ) {
102
102
d .SetId ("" )
@@ -123,11 +123,7 @@ func resourceScalewayFunctionNamespaceUpdate(ctx context.Context, d *schema.Reso
123
123
return diag .FromErr (err )
124
124
}
125
125
126
- ns , err := api .WaitForNamespace (& function.WaitForNamespaceRequest {
127
- Region : region ,
128
- NamespaceID : id ,
129
- RetryInterval : DefaultWaitRetryInterval ,
130
- }, scw .WithContext (ctx ))
126
+ ns , err := waitForFunctionNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutUpdate ))
131
127
if err != nil {
132
128
if is404Error (err ) {
133
129
d .SetId ("" )
@@ -137,7 +133,7 @@ func resourceScalewayFunctionNamespaceUpdate(ctx context.Context, d *schema.Reso
137
133
}
138
134
139
135
req := & function.UpdateNamespaceRequest {
140
- Region : region ,
136
+ Region : ns . Region ,
141
137
NamespaceID : ns .ID ,
142
138
}
143
139
@@ -162,20 +158,20 @@ func resourceScalewayFunctionNamespaceDelete(ctx context.Context, d *schema.Reso
162
158
return diag .FromErr (err )
163
159
}
164
160
165
- _ , err = api .WaitForNamespace (& function.WaitForNamespaceRequest {
166
- Region : region ,
167
- NamespaceID : id ,
168
- RetryInterval : DefaultWaitRetryInterval ,
169
- }, scw .WithContext (ctx ))
161
+ _ , err = waitForFunctionNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutDelete ))
170
162
if err != nil {
171
- return nil
163
+ return diag . FromErr ( err )
172
164
}
173
165
174
166
_ , err = api .DeleteNamespace (& function.DeleteNamespaceRequest {
175
167
Region : region ,
176
168
NamespaceID : id ,
177
169
}, scw .WithContext (ctx ))
170
+ if err != nil {
171
+ return diag .FromErr (err )
172
+ }
178
173
174
+ _ , err = waitForFunctionNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutDelete ))
179
175
if err != nil && ! is404Error (err ) {
180
176
return diag .FromErr (err )
181
177
}
0 commit comments