-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ec2: Unable to use imported interface VPC endpoint in another stack #30507
Comments
I tried to simplify your provided code snippet and this works for me stack.ts export class Stack1 extends Stack {
public readonly executeApiEndpoint: ec2.IInterfaceVpcEndpoint;
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
this.executeApiEndpoint = ec2.InterfaceVpcEndpoint.fromInterfaceVpcEndpointAttributes(this, `vpc`, {
vpcEndpointId: 'dummy-id',
port: 443
});
}
}
export interface Stack2Props extends StackProps {
readonly executeApiEndpoint: ec2.IInterfaceVpcEndpoint;
}
export class Stack2 extends Stack {
constructor(scope: Construct, id: string, props: Stack2Props) {
super(scope, id, props);
const api = new apigateway.RestApi(this, 'RestApi', {
restApiName: 'dummy-name',
endpointConfiguration: {
types: [apigateway.EndpointType.PRIVATE],
vpcEndpoints: [props.executeApiEndpoint]
},
});
api.root.addMethod('GET');
}
} app.ts const stack1 = new Stack1(app, 'stack1');
new Stack2(app, 'stack2', {
executeApiEndpoint: stack1.executeApiEndpoint,
}); cdk diff
|
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
I created stacks from scratch and it seems that everything really works, maybe I missed something somewhere. I'm closing the issue. |
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
I am using two stacks. In one of them, I import the VPC endpoint if it already exists, and if not, I create a new one. Then I create a new stack in which I want to deploy a Private API Gateway, which needs to be provided with the VPC endpoint.
vps-stack.ts
bin/app.ts
application-stack.ts (api gateway part)
The problem is that if I import the resource from the same stack where the API Gateway is created, everything works, but if these are different stacks, I get an error.
Error:
CDK synth fine If i will import VPC endpoint in the same stack, like in this the way:
Expected Behavior
Import interface VPC endpoint in one Stack and use it for Private API Gateway in another stack should work.
Current Behavior
The problem is that if I import the resource from the same stack where the API Gateway is created, everything works, but if these are different stacks, I get an error.
Error:
Reproduction Steps
Create two stacks.
First contain
Second contain
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.145.0
Framework Version
No response
Node.js Version
v22.2.0
OS
Mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: