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

Deploy Multiple Stacks at Once #650

Closed
skorfmann opened this issue Apr 20, 2021 · 9 comments
Closed

Deploy Multiple Stacks at Once #650

skorfmann opened this issue Apr 20, 2021 · 9 comments
Assignees
Labels
cdktf-cli enhancement New feature or request feature/multi-stack priority/important-longterm Medium priority, to be worked on within the following 1-2 business quarters.
Milestone

Comments

@skorfmann
Copy link
Contributor

skorfmann commented Apr 20, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

With #636 we introduced multiple stacks where we handle only one stack at the time via a given target-stack argument. We should enable a full, automated deployment.

  • Resolve dependencies of stacks and build DAG
  • Execute accordingly

References

@skorfmann skorfmann added the enhancement New feature or request label Apr 20, 2021
@DanielMSchmidt
Copy link
Contributor

This would be useful together with the Kubernetes Provider, a cluster normally needs some workloads on it to be useful, but the provider credentials can't be set to a not yet existing cluster.

Is this strictly blocked on #651? We can not infer the DAG based on references, but we could introduce an intermediate API that we can remove once the cross-stack references work. This would enable us to do some of this worked removed from the reference work.

I thought of sth to the effect of this as an API:

const app = new App();
const infraLayer = new Infrastructure(app, "infra");
const appLayer = new Applications(app, "app");

appLayer.dependsOn(infraLayer);

app.synth();

This would have non of the magic, you would need to use Terraform Data Elements in the application layer to get the resource context of the cluster, but you could express the relationship already.
This example would schedule a run of the infra layer before the run of the app layer, if the app layer is used as target-stack attribute

@DanielMSchmidt
Copy link
Contributor

Talked with @ansgarm: We need to find a good UX around selecting the stacks to deploy.

  • We could have a --with-dependencies flag and use one stack as an argument
  • We could supply a list of stacks (possibly a glob like syntax) and deal with order for the user (would be a bit better I think as it could allow us to deal with parallel execution for the user at some point)

@skorfmann
Copy link
Contributor Author

I really like that direction @DanielMSchmidt - The reason you have to select a stack right now is, that we can't resolve dependencies between stacks. If we would be able to do this, why not deploy all of them by default and allow the user to filter with the glob style you described?

@DanielMSchmidt
Copy link
Contributor

No, if we introduce the API mentioned we would be able to describe dependencies between stacks. We can not automatically derive them before #651 is done though. The idea for the glob was to have the least surprising interface by default. Being a bit more verbose would help to avoid confusion if more than one stack is deployed / destroyed

@jsteinich
Copy link
Collaborator

May want to follow what AWS CDK does: https://docs.aws.amazon.com/cdk/latest/guide/cli.html#cli-stacks

@DanielMSchmidt
Copy link
Contributor

yeah that's exactly what I meant, thank for the link!

@DanielMSchmidt
Copy link
Contributor

Putting feedback from @ansgarm here:

Ideally the cdktf-cli could read the stack dependencies and check this in TFC and offer to setup the required permissions. But that's definitely something for the future 😁

@DanielMSchmidt
Copy link
Contributor

Closed by

@github-actions
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cdktf-cli enhancement New feature or request feature/multi-stack priority/important-longterm Medium priority, to be worked on within the following 1-2 business quarters.
Projects
None yet
Development

No branches or pull requests

7 participants