Open Mykhailo-Roit opened 8 months ago
Hi Mykhailo,
I'm not a terragrunt user myself, so I'll need more input.
Does the plan output look exactly like a standard terraform plan, so that it'll parse the same way?
Can you give me an example of such a terragrunt command? Maybe I'll add the option to manually edit the plan command on-screen, or get it from an environment variable / command parameter, etc.
Hi @idoavrah
terragrunt is a wrapper for a terraform. It only makes easy terraform execution.
Terragrunt as terraform wrapper generate plan:
terragrunt plan -out tfplan
can execute command like this terraform plan -var-file=../configs/identity-prd.tfvars -var-file=../configs/resources-prd.tfvars -var-file=../configs/subnets-prd.tfvars -out tfplan
So you can use only terraform to generate tfplan file
terraform plan -out tfplan
FYI my today pain is analyze a huge list after terraform plan: "Plan: 476 to add, 0 to change, 38 to destroy."
I can't use an existing plan file, because I'm parsing the OUTPUT text, not the binary file itself.
Is the only difference between a "regular" plan command and the one you've written is the number of var-files? If I add support for multiple varfiles, will it suffice? (assuming you're running terragrunt as the executable).
I can run terraform show tfplan -no-color >tfplan.txt
to convert plan to the plain text format or generate json using terraform show -json tfplan > tfplan.json
. This is not a problem
What terraform command do you use for getting plan to analyze?
I'm parsing the OUTPUT text, not the binary file itself.
But here I see that you use binary format https://github.com/idoavrah/terraform-tui/blob/main/tftui/plan.py#L36
Is the only difference between a "regular" plan command and the one you've written is the number of var-files?
yes, but names for these vars file generated based on execution directory name Here part of the terragrunt config with generating var-file names
arguments = [
"-var-file=./resources-${local.env}.json",
"-var-file=./subnets-${local.env}.json",
"-var-file=./../tf-configs/${local.zone}/terraform-${local.env}.tfvars"
]
Does it possible to visualization tfplan created outside tftui (e.g. by terragrunt with extra options like several dynamic generated links to vars files)?