Skip to content

Doubt: About change at stacks-map.js #160

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

Open
thadeu opened this issue Mar 16, 2021 · 1 comment
Open

Doubt: About change at stacks-map.js #160

thadeu opened this issue Mar 16, 2021 · 1 comment

Comments

@thadeu
Copy link

thadeu commented Mar 16, 2021

If I adjust an existing stacks-map.js this way, I need recreating my stack?

My stacks-map.js looks like this

module.exports = {
    'AWS::AppSync::ApiKey': { destination: 'AppSync', allowSuffix: true },
    'AWS::AppSync::DataSource': { destination: 'AppSync', allowSuffix: true },
    'AWS::AppSync::FunctionConfiguration': { destination: 'AppSync', allowSuffix: true },
    'AWS::AppSync::GraphQLApi': { destination: 'AppSync', allowSuffix: true },
    'AWS::AppSync::GraphQLSchema': { destination: 'AppSync', allowSuffix: true },
    'AWS::AppSync::Resolver': { destination: 'AppSync', allowSuffix: true },
    'AWS::CloudWatch::Alarm': { destination: 'Alarms', allowSuffix: true,  force: true}
 }

I may not recreate my stack! :(

@dougmoscrop
Copy link
Owner

New resources will follow stacks-map, existing resources stay where they are.

This is a limitation of Cloud Formation :(

There is support for import resources, https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html

So, in theory this plugin could offer a command like serverless split-stacks migrate --resource=ResourceName --target=StackName but no work has been done on anything like that. It would be fairly complex, you would need to:

  • resolve any fn::imports that refer to that resources, substitute them with static hard coded values (e.g. ARN of something)
  • set retention policy on the resource to keep
  • remove the resources from the current stack and update the stack
  • import the resource in to the new stack, exporting it like before, if that was the case
  • update previous fn::imports that were temporarily hard-coded, to now import again

In other words, it would involve coordinating numerous, iterative updates to multiple stacks and nobody has tackled this AFAIK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants