-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vpcEndpointIds as an option on SpecRestApi #33295
Comments
Appears to be a miss. SpecRestApi construct appears to set Moving Could not find any CloudFormation documentation where it states that EndpointConfiguration should not be defined for AWS::ApiGateway::RestApi, which represents a REST API in Amazon API Gateway, created with an OpenAPI specification. @acwatson Feel free to contribute PR for the fix, if possible. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
…33514) ### Issue # (if applicable) Closes aws#33295 ### Reason for this change SpecRestApi support `endpointConfiguration` ### Description of changes Move endpointConfiguration to RestApiBaseProps ### Description of how you validated changes Unit + integ ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
The SpecRestApiProps interface (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.SpecRestApiProps.html) is missing the property called "endpointConfiguration". This property got added to the plain RestApi construct, but not the SpecRestApi construct. You can see the endpointConfiguration property is defined in the RestApiProps interface (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApiProps.html).
The endpointConfiguration property is needed so that the API GW can be configured to reference VPC endpoint IDs.
I think what happened is that when this issue was fixed for RestApi (#6038), the implementers did not realize they should also update the SpecRestApi.
I looked at the SpecRestApi code and I see that it actually does support the endpointConfiguration configuration, its just that this property is not defined in the SpecRestApiProps interface. I was able to get the SpecRestApi to use my VPC endpoint IDs by hacking the props input like so:
const endpointConfiguration: apigw.EndpointConfiguration = {
types: [apigw.EndpointType.PRIVATE],
vpcEndpoints: [props.apiGwVpcEndpoint]
};
// Add the missing "endpointConfiguration" property
const apiPropsExtensions = {
endpointConfiguration
};
const specApiProps: apigw.SpecRestApiProps = {
apiDefinition,
...
}
// Hacking type-safety and passing in the endpointConfiguration using the spread operator
const api = new apigw.SpecRestApi(this, "MyAPI", {...specApiProps, ...apiPropsExtensions});
Regression Issue
Last Known Working CDK Version
2.177.0
Expected Behavior
The SpecRestApiProps interface should have a "endpointConfiguration" property just like the RestApiProps interface does. It is needed so that the API GW can be configured with VPC endpoint IDs.
Current Behavior
The SpecRestApiProps interface does not have a "endpointConfiguration" property, so it is necessary to use an "escape hatch" approach and set VPC endpoint IDS using the L1 construct or using the spread operator like I did in my bug description.
Reproduction Steps
//This will not compile due to the endpointConfiguration property not being in the interface
const specApiProps: apigw.SpecRestApiProps = {
apiDefinition,
restApiName:
${apiIdentifier}
,deploy: true,
description:
My API
,endpointConfiguration: {
types: [apigw.EndpointType.PRIVATE],
vpcEndpoints: [props.apiGwVpcEndpoint]
}
}
Possible Solution
Update the SpecRestApiProps to have an endpointConfiguration property, just like RestApiProps.
Additional Information/Context
No response
CDK CLI Version
2.177.0
Framework Version
No response
Node.js Version
v18.20.4
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: