Skip to content

Commit aa4163d

Browse files
authored
fix: prevent 409 errors in is_virtual_endpoint_gateway by locking on VPC ID during create (#6378)
1 parent ce0c21e commit aa4163d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ibm/service/vpc/resource_ibm_is_virtual_endpoint_gateway.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212
"time"
1313

14+
"github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns"
1415
"github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex"
1516
"github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate"
1617
"github.com/IBM/go-sdk-core/v5/core"
@@ -337,6 +338,11 @@ func resourceIBMisVirtualEndpointGatewayCreate(context context.Context, d *schem
337338
vpcOpt := &vpcv1.VPCIdentity{
338339
ID: core.StringPtr(vpcID),
339340
}
341+
if vpcID != "" {
342+
isVPCKey := "vpe_vpc_key_" + vpcID
343+
conns.IbmMutexKV.Lock(isVPCKey)
344+
defer conns.IbmMutexKV.Unlock(isVPCKey)
345+
}
340346

341347
// update option
342348
opt := sess.NewCreateEndpointGatewayOptions(targetOpt, vpcOpt)

0 commit comments

Comments
 (0)