spin-up could do terragrunt apply for multiple .terragrunt files in sub-directories.
However, it still needs terragrunt plan within each sub-directories to see the diff before apply. How about make spin-up support plan to see the summary of change in sub-directories as well?
Are you suggesting that spin-up shows you the terraform plan output for each module before running terraform apply in all of them? I suppose an interactive "does this plan look OK?" that lets you preview what will happen before you do it would make sense. Perhaps it should be part of a new command like (e.g. terragrunt spin-up-plan). PRs welcome :)
I think spin-up and tear-down should be deprecated in favor of; plan-all, apply-all, and destroy-all. Not having a plan-all makes the use of spin-up risky and not really feasible for use.
@dhoer I like that idea!
a output-all would also be a helpful command to have instead of going into each directory to do an output there.
I started to work on plan-all in this branch:
https://github.com/fajpunk/terragrunt/tree/plan-all
The conceptual problem that I've run into is that a plan for one module (using module here as in the codebase--a collection of terraform config with its own remote state--rather than module as in a terraform module) may depend on outputs in the remote state from another as-yet-unapplied module. This is caught in this update to the integration tests:
https://github.com/fajpunk/terragrunt/blob/plan-all/test/integration_test.go#L193
Which eventually shows this error:
```[terragrunt] [/tmp/terragrunt-stack-test061199604/fixture-stack/mgmt/bastion-host] 2017/02/22 21:28:50 Running command: terraform plan -var terraform_remote_state_s3_bucket="terragrunt-test-bucket-5z6pgc"
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.
data.terraform_remote_state.vpc: Refreshing state...
Error running plan: 1 error(s) occurred:
Is there any way around this?
I think the closest we could get is a command to show plan output for each module, and require interactive confirmation to apply, before moving on to the next module, like @brikis98 suggested in https://github.com/gruntwork-io/terragrunt/issues/118#issuecomment-277235348 .
Yes, I think that's correct. If a module has dependencies that haven't been deployed yet, you can't show a plan for it, so the interactive, plan-confirm-apply-repeat approach is probably as good as it'll get here.
Ok, I'll give this a shot over the weekend. What should the command be called? confirm-apply-all?
Perhaps spin-up-interactive? Or if the commands are going to be renamed to apply-all and destroy-all, then I guess this one would be apply-all-interactive.
@fajpunk could output-all mentioned by @beanderson be added to the PR as well?
@brikis98 @fajpunk Could the interactive be a switch, e.g. apply-all -i or apply-all --interactive? I can see using this for plan-all, output-all, etc.. as well to look at each section.
@fajpunk Is this something you're still working on?
Sorry @luis-silva, I'm not working on this anymore. Go for it!
Fixed in #195.
Most helpful comment
I think
spin-upandtear-downshould be deprecated in favor of;plan-all,apply-all, anddestroy-all. Not having a plan-all makes the use of spin-up risky and not really feasible for use.