feat: add support for VPCEndpointIds in EndpointConfiguration - #1524
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1524 +/- ##
========================================
Coverage 94.10% 94.10%
========================================
Files 78 78
Lines 4951 4956 +5
Branches 999 1001 +2
========================================
+ Hits 4659 4664 +5
Misses 135 135
Partials 157 157
Continue to review full report at Codecov.
|
|
sorry for all the commits :) In the expected output JSON I added, I'm unsure of how the Parameters section of AWS::ApiGateway::RestApi is supposed to look. Could someone point me in the right direction? |
|
AWS::ApiGateway::RestApi Parameters only allows simple string:string mappings, so I've kept it so that EndpointConfiguration only allows specifying 1 Type. I've tested this in my environment and it works, but I'm still not sure of the significance of setting these custom headers. |
|
would be great to get this merged! we are going to start using private gateways soon and require this |
|
Any ETA for this being released? |
|
This looks good overall, taking a deeper look to make sure there are no breaking changes from the current implementation. |
|
Any update on this PR @sriram-mv? I'm currently running into the issue this PR will address, which is, in Thanks! |
|
Would a command such as: After a deployment be a viable workaround until this is merged? Edit: Yes it does, so after a sam deploy just run this command and your endpoint will follow the following pattern: |
|
Is is possible to move |
|
That may be possible if someone wants to start over, but this implementation was @ShreyaGangishetty recommendation from #1327 |
|
@sriram-mv I am just trying to understand your push back here? Personally, I think how this PR is laid out now is ok. My main thought process behind this is: EndpointConfiguration maps to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html Long ago, we made the decision to make EndpointConfiguration should be a string and for a couple years the only property of EndpointConfiguration was the "Types". In SAM, we simplified that definition to be just the value of EndpointConfiguration. Hindsight is 20/20, but now that there is another property I think it makes sense to keep this mapping to it. My main reason for that is, if tomorrow API Gateway adds another feature under EndpointConfiguration, where do we put it? I don't think we want to keep endlessly deduping these properties. Honestly, there is a lot of SAM that can just be pass through and can get out of the way, instead of us trying to always keep up with CloudFormation (which we know is hard). So if we have a strong reason to not put this under EnpointConfiguration in SAM, lets come up with a way to do that and not go down this endless "if another Property is added, we need to add it to @scbrown Thanks you for getting us started here! I will work with @sriram-mv to come to a resolution and update this PR accordingly. |
|
@jfuss My primary concern was with backward compatibility, but if endpoint configuration being private under SAM was not supported anyway and the remaining endpoint configurations are backward compatible, I'm ok moving forward with this. I also 100% agree to be conformant with the CFN spec and not continuously add properties as needed. |
|
According to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html, Types is a list, but I cant find a real world use case where it actually is a list, whereas compared to SAM its just a string. With that in mind, I'm approving this PR. |
|
This is great news! 🎉 Thanks everyone for working on this, subscribed to 'watch' releases. |
|
Excellent news, been waiting for this 🥳 |
| elif endpoint not in ["EDGE", "REGIONAL", "PRIVATE"]: | ||
| raise InvalidResourceException( | ||
| self.logical_id, | ||
| "EndpointConfiguration for Custom Domains must be" " one of {}.".format(["EDGE", "REGIONAL"]), | ||
| "EndpointConfiguration for Custom Domains must be" | ||
| " one of {}.".format(["EDGE", "REGIONAL", "PRIVATE"]), |
There was a problem hiding this comment.
@sriram-mv / @scbrown Custom Domains are not supported on private APIs, right?
| if isinstance(value, dict) and value.get("Type"): | ||
| rest_api.Parameters = {"endpointConfigurationTypes": value.get("Type")} | ||
| rest_api.EndpointConfiguration = {"Types": [value.get("Type")]} | ||
| if "VPCEndpointIds" in value.keys(): |
There was a problem hiding this comment.
I didn't see this earlier, but I wished it was VpcEndpointIds instead of VPCEndpointIds, just for consistency. :) I did not realise and kept trying with VpcEndpointIds and could not get it to work (there's no error, so it deployed successfully, without VPCe).
There was a problem hiding this comment.
I agree with @saurabhshri. Would be better if the name can be made consistence as per cloudformation EndpointConfiguration properties.
This one confuses us, especially, because the documentation says the wrong thing.
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html#sam-api-endpointconfiguration
*Issue #1327
Description of changes:
Adds support for configuring a PRIVATE RestApi Endpoint
Description of how you validated changes:
added unit tests with expected input and output
Checklist:
make prpassesexamples/2016-10-31By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.