serverless-heaven/serverless-aws-alias

serverless-domain-manager

ColeTMNZ opened this issue · 3 comments

Is domain manager supported?

Have tried getting alias plugin running in existing stack, but not getting far.

The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [ApiGatewayDeployment1521079052823] in the Resources block of the template

#66 looks similar, where the suggestion is to locate unsupported resources. Im wondering if its the basepath mapping resource that's causing issues.

As far as I know domain manager is not yet supported. It's quite likely the base path mapping resource, because that's dependent on the Deployment resource.

But the deployment resource is moved to the alias stack - and the mapping resource is not. So the dependency is not valid anymore and will error.

An implementation for the feature might move the base mapping resource to the alias stack besides the Deployment resource, and the dependency is ok again.

The basepath mapping resource:

{
  "Type" : "AWS::ApiGateway::BasePathMapping",
  "Properties" : {
    "BasePath" : String,
    "DomainName" : String,
    "RestApiId" : String,
    "Stage" : String
  }
}

So the plugin would move it and set the Stage property to the current alias stage ref (Ref: aliasStage).

However, it has to be checked, if the outcome of that solution is, what we'd expect to happen for deployments into multiple parallel aliases - by testing an implementation of the feature.
Imo it would work that way, and even allow mutliple aliases be integrated into one base mapping domain seamlessly.

Hi,
I created a PR for this feature according to your description @HyperBrain, as I also am in need for this. I currently have to way to test this on an example project, as my private AWS account is limited regarding setting up certificates for domain names. I tested my implementation on a company project and it worked well. Except for some limitation on the domain manager plugin, which apparently only supports certificates from us-east-1 region.

@ColeTMNZ would you be able to test my implementation on an example project. Use my branch for testing https://github.com/aleksdikanski/serverless-aws-alias.git#domain-name-plugin-support

I believe the restriction to certs in us-east-1 is for Edge optimised Endpoint Configuration, Regional can use any cert in the matching region. This is a restriction / limitation of AWS API Gateway and not of serverless-domain-manager.

I have a setup with a Regional on eu-west-2 Endpoint and happy to give this a test when I get a few minutes spare.

In my tests of serverless-domain-manager I've always had the Endpoint created ahead and just used Serverless to configure the Base Path Mapping but can probably do a full end-to-end test without effecting users too much.

For reference this is the serverless-domain-manager config I used before switching to serverless-aws-alias:

  stage: ${opt:stage, self:provider.stage}

  domains:
    prod: api.xyz.uk
    dev: api-dev.xyz.uk

  customDomain:
    certificateName: '*.xyz.uk'
    domainName: ${self:custom.domains.${self:custom.stage}}
    basePath: 'Todo-API'
    stage: ${self:provider.stage}
    createRoute53Record: false