feat: custom domains Api Gateway support#1144
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1144 +/- ##
===========================================
+ Coverage 94.36% 94.47% +0.11%
===========================================
Files 71 71
Lines 3621 3677 +56
Branches 713 726 +13
===========================================
+ Hits 3417 3474 +57
+ Misses 104 103 -1
Partials 100 100
Continue to review full report at Codecov.
|
jlhood
left a comment
There was a problem hiding this comment.
Really excited to see movement on custom domain support! Lots of questions around edge case behavior. I don't think a single happycase test is sufficient here.
Also, are you planning to add an example as part of this PR?
36cb8c6 to
680d212
Compare
|
Just a note: I have a template with two AWS::Serverless::Api that share the same AWS::ApiGateway::DomainName each with a different AWS::ApiGateway::BasePathMapping. I guess this solution does not support that? Also found that using custom domains the AWS::ApiGateway::BasePathMapping needs a DepensOn on de Stage generated by AWS::Serverless::Api for succesful deploying |
|
@Jacco thanks for the feedback!
No unfortunately this doesn't support referencing an existing DomainName. Sounds like this would be good to have.
BasePathMapping references Api.Stage (this is a referable property exposed by SAM), which creates the necessary dependency chain. The BasePathMapping resource looks like this - MyApiBasePathMapping:
Type: AWS::ApiGateway::BasePathMapping
Properties:
DomainName: !Ref APIDomainName
RestApiId: !Ref MyApi
BasePath: one
Stage: !Ref MyApi.Stage ## this creates the dependency |
keetonian
left a comment
There was a problem hiding this comment.
Overall, looks good. This might be a silly question, but can you have multiple AWS::ApiGateway::DomainName resources that all have the same domain name + certificate but different logical Id's?
No, you can only create one ApiGateway DomainName per domain "www.example.com". CloudFormation deploy fails if you try to create another ApiGateway DomainName resource for an existing domain. |
Issue #, if available:
#1125, #1126, #1127, #783
Description of changes:
Adding basic custom domains handling to SAM. This only creates ApiGateway resources with a single basepath mapping to '/'
I found that I don't need to edit the swagger, APIGateway does this for me automatically when I create the BasePath Mappings.
Description of how you validated changes:
Tested deploying on CFN
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.