@@ -70,6 +70,11 @@ func resourceScalewayRegistryNamespaceCreate(ctx context.Context, d *schema.Reso
70
70
71
71
d .SetId (newRegionalIDString (region , ns .ID ))
72
72
73
+ _ , err = waitForRegistryNamespace (ctx , api , region , ns .ID , d .Timeout (schema .TimeoutCreate ))
74
+ if err != nil {
75
+ return diag .FromErr (err )
76
+ }
77
+
73
78
return resourceScalewayRegistryNamespaceRead (ctx , d , meta )
74
79
}
75
80
@@ -79,13 +84,7 @@ func resourceScalewayRegistryNamespaceRead(ctx context.Context, d *schema.Resour
79
84
return diag .FromErr (err )
80
85
}
81
86
82
- ns , err := api .WaitForNamespace (& registry.WaitForNamespaceRequest {
83
- Region : region ,
84
- NamespaceID : id ,
85
- Timeout : scw .TimeDurationPtr (d .Timeout (schema .TimeoutRead )),
86
- RetryInterval : DefaultWaitRetryInterval ,
87
- }, scw .WithContext (ctx ))
88
-
87
+ ns , err := waitForRegistryNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutRead ))
89
88
if err != nil {
90
89
if is404Error (err ) {
91
90
d .SetId ("" )
@@ -111,13 +110,7 @@ func resourceScalewayRegistryNamespaceUpdate(ctx context.Context, d *schema.Reso
111
110
return diag .FromErr (err )
112
111
}
113
112
114
- _ , err = api .WaitForNamespace (& registry.WaitForNamespaceRequest {
115
- Region : region ,
116
- NamespaceID : id ,
117
- RetryInterval : DefaultWaitRetryInterval ,
118
- Timeout : scw .TimeDurationPtr (d .Timeout (schema .TimeoutUpdate )),
119
- }, scw .WithContext (ctx ))
120
-
113
+ _ , err = waitForRegistryNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutUpdate ))
121
114
if err != nil {
122
115
if is404Error (err ) {
123
116
d .SetId ("" )
@@ -146,13 +139,7 @@ func resourceScalewayRegistryNamespaceDelete(ctx context.Context, d *schema.Reso
146
139
return diag .FromErr (err )
147
140
}
148
141
149
- _ , err = api .WaitForNamespace (& registry.WaitForNamespaceRequest {
150
- Region : region ,
151
- NamespaceID : id ,
152
- RetryInterval : DefaultWaitRetryInterval ,
153
- Timeout : scw .TimeDurationPtr (d .Timeout (schema .TimeoutDelete )),
154
- }, scw .WithContext (ctx ))
155
-
142
+ _ , err = waitForRegistryNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutDelete ))
156
143
if err != nil {
157
144
if is404Error (err ) {
158
145
d .SetId ("" )
@@ -165,7 +152,11 @@ func resourceScalewayRegistryNamespaceDelete(ctx context.Context, d *schema.Reso
165
152
Region : region ,
166
153
NamespaceID : id ,
167
154
}, scw .WithContext (ctx ))
155
+ if err != nil && ! is404Error (err ) {
156
+ return diag .FromErr (err )
157
+ }
168
158
159
+ _ , err = waitForRegistryNamespace (ctx , api , region , id , d .Timeout (schema .TimeoutDelete ))
169
160
if err != nil && ! is404Error (err ) {
170
161
return diag .FromErr (err )
171
162
}
0 commit comments