aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

AWS::ApiGateway::VpcLink implicit dependency not working

Open
#1,951 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

AWS::ApiGateway::VpcLink

### Resource Name

AWS::ElasticLoadBalancingV2::LoadBalancer

### Issue Description

When a stack is deployed containing an "AWS::ApiGateway::VpcLink" resource which references an "AWS::ElasticLoadBalancingV2::LoadBalancer" created in the same stack via "Ref", the VpcLink resource proceeds to provision before the LoadBalancer resource has returned a success.

Adding an explicit dependency solves this.

Issue: resource not respecting implicit dependency. Results in failed deployment "Failed to stabilize Vpc Link with id * Status Message NLB is not in active state. If you recently created this NLB, please wait for it to become active and try again.."

### Expected Behavior

Deploy template containing AWS::ApiGateway::VpcLink which implicitly refers to an AWS::ElasticLoadBalancingV2::LoadBalancer resource. CloudFormation waits for CREATE_COMPLETE before from LoadBalancer before starting VpcLink CREATE_IN_PROGRESS.

### Observed Behavior

CloudFormation starts the LoadBalancer resource deployment then starts the VpcLink deployment before receiving success. This creates a race condition where often stack deployment fails. Implicit dependency is not observed.

### Test Cases

SAMPLE TEMPLATE:
```
{
"Resources": {

"MyNLB": {
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
"Properties": {
"LoadBalancerAttributes": [{
"Key": "deletion_protection.enabled",
"Value": "false"
}
],
"Name": "MyNLB",
"Scheme": "internal",
"Subnets": [
"",
""
],
"Type": "network"
}
},

"MyVpcLink": {
"Type": "AWS::ApiGateway::VpcLink",
"Properties": {
"Name": "my-vpc-link",
"TargetArns": [{
"Ref": "MyNLB"
}
]
}
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by deploying the sample template with an AWS::ElasticLoadBalancingV2::LoadBalancer and AWS::ApiGateway::VpcLink, first using the implicit Ref and then an explicit dependency. Compare deployment ordering and stabilization failures. Done means CloudFormation waits for the load balancer to reach CREATE_COMPLETE before starting VpcLink creation, without requiring an explicit dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.