Skip to content

Commit ead75d9

Browse files
authored
feat(vpc-gw): add support for configurable timeout for pat rules (#1169)
1 parent b8d78ff commit ead75d9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scaleway/resource_vpc_public_gateway_pat_rule.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func resourceScalewayVPCPublicGatewayPATRule() *schema.Resource {
2323
StateContext: schema.ImportStatePassthroughContext,
2424
},
2525
SchemaVersion: 0,
26+
Timeouts: &schema.ResourceTimeout{
27+
Default: schema.DefaultTimeout(gatewayWaitForTimeout),
28+
},
2629
Schema: map[string]*schema.Schema{
2730
"gateway_id": {
2831
Type: schema.TypeString,
@@ -91,7 +94,7 @@ func resourceScalewayVPCPublicGatewayPATRuleCreate(ctx context.Context, d *schem
9194
_, err = vpcgwAPI.WaitForGateway(&vpcgw.WaitForGatewayRequest{
9295
GatewayID: gatewayID,
9396
Zone: zone,
94-
Timeout: scw.TimeDurationPtr(gatewayWaitForTimeout),
97+
Timeout: scw.TimeDurationPtr(d.Timeout(schema.TimeoutCreate)),
9598
RetryInterval: &retryInterval,
9699
}, scw.WithContext(ctx))
97100
if err != nil {
@@ -116,7 +119,7 @@ func resourceScalewayVPCPublicGatewayPATRuleCreate(ctx context.Context, d *schem
116119
_, err = vpcgwAPI.WaitForGateway(&vpcgw.WaitForGatewayRequest{
117120
GatewayID: res.GatewayID,
118121
Zone: zone,
119-
Timeout: scw.TimeDurationPtr(gatewayWaitForTimeout),
122+
Timeout: scw.TimeDurationPtr(d.Timeout(schema.TimeoutCreate)),
120123
RetryInterval: &retryInterval,
121124
}, scw.WithContext(ctx))
122125
if err != nil {
@@ -178,7 +181,7 @@ func resourceScalewayVPCPublicGatewayPATRuleUpdate(ctx context.Context, d *schem
178181
_, err = vpcgwAPI.WaitForGateway(&vpcgw.WaitForGatewayRequest{
179182
GatewayID: patRules.GatewayID,
180183
Zone: zone,
181-
Timeout: scw.TimeDurationPtr(gatewayWaitForTimeout),
184+
Timeout: scw.TimeDurationPtr(d.Timeout(schema.TimeoutUpdate)),
182185
RetryInterval: &retryInterval,
183186
}, scw.WithContext(ctx))
184187
if err != nil {
@@ -233,7 +236,7 @@ func resourceScalewayVPCPublicGatewayPATRuleDelete(ctx context.Context, d *schem
233236
_, err = vpcgwAPI.WaitForGateway(&vpcgw.WaitForGatewayRequest{
234237
GatewayID: patRules.GatewayID,
235238
Zone: zone,
236-
Timeout: scw.TimeDurationPtr(gatewayWaitForTimeout),
239+
Timeout: scw.TimeDurationPtr(d.Timeout(schema.TimeoutDelete)),
237240
RetryInterval: &retryInterval,
238241
}, scw.WithContext(ctx))
239242

@@ -253,7 +256,7 @@ func resourceScalewayVPCPublicGatewayPATRuleDelete(ctx context.Context, d *schem
253256
_, err = vpcgwAPI.WaitForGateway(&vpcgw.WaitForGatewayRequest{
254257
GatewayID: patRules.GatewayID,
255258
Zone: zone,
256-
Timeout: scw.TimeDurationPtr(gatewayWaitForTimeout),
259+
Timeout: scw.TimeDurationPtr(d.Timeout(schema.TimeoutDelete)),
257260
RetryInterval: &retryInterval,
258261
}, scw.WithContext(ctx))
259262

0 commit comments

Comments
 (0)