Azure / deployment-stacks

Contains Deployment Stacks CLI scripts and releases
MIT License
87 stars 7 forks source link

Ability to deploy multiple templates with single stack #29

Closed slavizh closed 1 year ago

slavizh commented 2 years ago

Is your feature request related to a problem? Please describe. We have different solutions that are separate from each other and deploy different services. Let's say we have a solution for deploying Web App and another solution for deploying Azure SQL Database. I would like to be able to deploy these one after the other and they to be in a single stack.

Describe the solution you'd like When I use the command New-AzSubscriptionDeploymentStack I would like to be able to define multiple solutions (templates) with separate parameter files for each and the deployments to be executed in serial mode in the order they have been provided but like a single stack.

For example

New-AzSubscriptionDeploymentStack -Name myStack -Location "North Europe" -TemplateFile .\solution1\main.json,.\solution1\main.json -TemplateParameterFile .\solution1\main.parameters.json,.\solution2\main.parameters.json -UpdateBehavior purgeResources -Force

Describe alternatives you've considered I know that this probably can be achieved if I create another template that references the main template files or the deployment specs for those in deployment resources but that would mean that we need to create such templates for every different scenario of chosen solutions When you have 80+ solutions covering all scenarios results in quite a lot of combinations.

I think deployment stacks should be able to combine multiple deployments and being able to execute them in serial. This will also make the experience better as people do not have to create additional files or modify their existing solutions.

Additional context This is something we have discussed before before the private preview.

bmoore-msft commented 2 years ago

Yep - right now the thinking is that you'd use a wrapper template... One thing that stands out for me in your example that web & sql would not be part of the same stack as they have different lifecycles (typically). Another way to look at it... if the next time I came along to deploy the stack, I forgot to include one of those templates on the cmd line, those resources are either no longer part of the stack or gone from Azure. So in the event they do have the same lifecycle, the solution is more fragile because your "source of truth" is not a template but a cmd line (and multiple templates).

re: the lifecycle issue again - If I were to use the same model for non-stack deployments what would it look like?

For your more complex scenarios (e.g. module like deployments) I'd go to templateSpecs and/or bicep for the stack definition.

slavizh commented 2 years ago

In current case we have separate jobs in the pipeline that deploy the different solutions so they run within the same pipeline. I would like to offer different options to end users in simplest way possible thus why the command line option proposal.

bmoore-msft commented 1 year ago

[coming back to clean up a bit before the next wave]

@slavizh - after letting this bake a bit, I do think the solution is multiple stacks or a wrapper template... Are you seeing any reason why that wouldn't work?

slavizh commented 1 year ago

can be closed for now.