amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.
MIT License
941 stars 232 forks source link

Export Names format prevents using plugin in different stacks #491

Open danielstandby opened 2 years ago

danielstandby commented 2 years ago

Hi,

I'm having an issue using this plugin in multiple stacks deploying to the same AWS account. CloudFormation Export Names have to be unique across the same AWS account.

The problem resides that the Export logical IDs are being formed using this templates:

sls-${service.service}-${domain.stage}-DistributionDomainName sls-${service.service}-${domain.stage}-DomainName sls-${service.service}-${domain.stage}-HostedZoneId

If the values of service and stage are the same for to different stacks. The first one succeeds because there aren't any exports yet. But the second one fails stating that the export name has already been used.

Normally, one would be able to easily solve this by overriding the Export name using the Outputs attribute like this:

Outputs:
  DistributionDomainName:
    Export:
      Name: something-else-DistributionDomainName

But unfortunately, that doesn't work in this case. I presume is due to the plugin is using the CloudFormation API to perform its actions. It works fine until release 5.3.0. In release 5.3.1 where you included de Export, the mentioned behavior happens.

I can think of a couple of possibilities:

Thank you.