Skip to content
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

Model stack dependencies / deployment order #937

Closed
RomainMuller opened this issue Oct 16, 2018 · 5 comments
Closed

Model stack dependencies / deployment order #937

RomainMuller opened this issue Oct 16, 2018 · 5 comments
Labels
feature-request A feature should be added or improved.

Comments

@RomainMuller
Copy link
Contributor

RomainMuller commented Oct 16, 2018

Sometimes stacks need to be deployed in a particular order in order for the deployment to succeed, as one stack depends on artifacts created by another (either via Fn::Import, or indirectly through custom resources, SSM parameters, ...). Currently, the CDK does not understand those dependencies and cdk deploy processes stacks in an arbitrary order.

In order to enable more sophisticated scenarios for interactions between stacks, for example allowing a construct to create a "helper" CDK Stack to be deployed before it's host stack.

An example use-case is when creating a custom domain mapping for an edge-optimized API Gateway endpoint, the ACM certificate needs to reside in the us-east-1 region, regardless of the region the API is defined in. One might want to create a "helper" stack in us-east-1 to manage the certificate.

Initially, the dependency would be explicitly modeled, but it could be determined automatically in the future.

For example, it could look like the following:

const domain = 'api.foo.acme.com';
const stackFoo = new cdk.Stack(app, 'Foo', { domain });
const stackBar = new cdk.Stack(app, 'Bar', { domain, env: { region: 'us-east-1' } });

// 'Foo' needs 'Bar' to be deployed in order to be deployable
stackFoo.dependsOnStack(stackBar);
@eladb
Copy link
Contributor

eladb commented Oct 16, 2018

This is should be covered by cloud assemblies (#233). In some cases it should be possible to deduce these automatically when there are cross-stack dependencies.

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 16, 2018

It will also help for integration tests.

Yes, it would be better if these were derived automatically, but they aren't right now and this is a low-effort investment to get at least some affordances in place and update our tools to be able to act upon the data. We can always improve the dependency collection mechanism later.

@eladb
Copy link
Contributor

eladb commented Oct 16, 2018

Sure

@srchase srchase added feature-request A feature should be added or improved. and removed enhancement labels Jan 3, 2019
@abelmokadem
Copy link
Contributor

Is there a way to force all these exports? So that there is no need to delete these Cfn Outputs in the first place.

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 30, 2019

We actually have a stack dependency mechanism right now, so I'm closing this PR.

@abelmokadem, I don't really understand your comment about forcing exports and deleting outputs, but feel free to make a new issue about it.

@rix0rrr rix0rrr closed this as completed Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

5 participants