careful-address-89803
02/06/2024, 6:33 PMexperimental-deploy --dry-run
? I think it's a common-enough feature of infra/deployables that we can standardise it in Pants, and I'm pretty sure we could write an opt-in/out mechanism for individual backends. This MR adds an implementation for that for the Terraform backend. Helm implements dry-run with passthrough args, although that strategy doesn't work for backends where the command is different (instead of just the flags. eg for Terrraform that's apply/plan)gorgeous-winter-99296
02/06/2024, 6:41 PMgorgeous-winter-99296
02/06/2024, 6:42 PMhappy-kitchen-89482
02/06/2024, 7:53 PMnutritious-hair-72580
02/07/2024, 4:26 AMplan
is more than a dry-run - it's calculating the changes that will be applied.curved-television-6568
02/07/2024, 8:11 AMpants experimental-deploy --dry-run --terraform-dry-run=plan ...
curved-television-6568
02/07/2024, 8:11 AMgorgeous-winter-99296
02/07/2024, 8:17 AMI think it makes sense. Although has anyone thought about how the plan->apply workflow would work in terms of saving the plan output for the apply step?
In this sense, terraform plan is more than a dry-run - it's calculating the changes that will be applied.
We use Bazel for our infra at work, but we don't use plan for this capability either. When we apply we review the changes in-situ while holding the lock. So we actually only use plan as a dry-run/preview as well.
careful-address-89803
02/07/2024, 9:55 PMimport
, helm's rollback
).
In previous discussions about the Pants deploying things, one key point was that Pants should focus on what it's good at. Pants doesn't focus on all the details of deployments, but does focus on user-friendliness and extensibility. I think having a standardised way of doing the most common actions supports the user-friendliness, and then per-backend options (like suggested by Andreas) supports the extensibility. I think that a "deploy" and a "preview" are those common actions, and I think we've got support for that in this thread. I'll review the MR soon (hopefully tonight!) so we can get it merged.
Users could also use Pants to export
all the dependencies for a deployment to do more advanced operations. I'm currently doing some work to get the Terraform backend to support that.careful-address-89803
02/07/2024, 10:01 PMpants experimental-deploy infra:infra --dry-run "--download-terraform-args=-out=$(pwd)/infra_plan"
pants experimental-deploy infra:infra "--download-terraform-args=$(pwd)/infra_plan"
I think that's not ideal and relies on "escaping" the sandbox. A backend-specific option like Andreas proposed would make more sense.nutritious-hair-72580
02/07/2024, 11:19 PM