Closed schlomo closed 3 years ago
We have the same issue at our side!
Looks like this part caused it to break: https://github.com/gruntwork-io/terragrunt/commit/7b2e87569e0df31579fd304b35d540d3209f3f7a#diff-fbaccdaf1ea9f78ae69c6b3910b2508d9bc578801035a65c6d110fa6e717dd73R52
-input=false
/ -auto-approve
are being appended at the end of the Terraform command while Terraform expects the plan file as the last argument.
I'm just astonished this passed testing.
As a workaround while waiting for a patch, I've reverted to 0.27.4 wherever I use this workflow.
Have a PR with a fix in https://github.com/gruntwork-io/terragrunt/pull/1544
We missed this because we generally discourage using plan-all
especially with plan files due to the issues surrounding dependencies. If you want to know why, you can read through the warning at https://terragrunt.gruntwork.io/docs/reference/cli-options/#plan-all-deprecated-use-run-all . With that said, this is something we do want to allow working so there is a new regression test in the PR to ensure it works going forward.
This happens also on
terragrunt run-all apply --terragrunt-parallelism 5 --terragrunt-non-interactive
terragrunt version v0.28.2
Terraform v0.14.6
It's still asking for a confirmation:
Are you sure you want to run 'terragrunt apply' in each folder of the stack described above? (y/n)
@jthenne Ah I think that is actually a logging issue. If you run with --terragrunt-log-level info
, you should a log entry immediately following that that saids something along the lines of Skipping interactive prompts due to running in non-interactive mode
.
It did break our CICD.
I fixed it by adding --terragrunt-log-level
as in:
terragrunt run-all --terragrunt-non-interactive --terragrunt-source-update --terragrunt-parallelism 5 --terragrunt-log-level info apply
Fix rolled out as https://github.com/gruntwork-io/terragrunt/releases/tag/v0.28.4 . Binaries should show up shortly.
Hey, I'm looking to create multiple AWS resources using Terragrunt's plan output file. These resources have dependencies on each other; EC2 instances and a transit gateway are reliant on a VPC. However, when applying Terragrunt using the plan, I encounter an issue where it's using a mock output value. This issue is only happening while using terragrunt apply-all plan. $ terragrunt plan-all -out plan $ terragrunt apply-all plan
. ├── accounts.json ├── common.hcl ├── modules │ ├── shared-ec2 │ │ ├── cloudwatch-alarm.tf │ │ ├── context.tf │ │ ├── docs │ │ │ ├── targets.md │ │ │ └── terraform.md │ │ ├── eni.tf │ │ ├── LICENSE │ │ ├── main.tf │ │ ├── Makefile │ │ ├── outputs.tf │ │ ├── README.md │ │ ├── README.yaml │ │ ├── security_group.tf │ │ ├── ssm_patch.tf │ │ ├── variables.tf │ │ └── versions.tf │ └── vpc-module │ ├── CHANGELOG.md │ ├── LICENSE │ ├── locals.tf │ ├── main.tf │ ├── Makefile │ ├── outputs.tf │ ├── README.md │ ├── UPGRADE-3.0.md │ ├── variables.tf │ ├── versions.tf │ └── vpc-flow-logs.tf ├── README.md ├── sandbox-account │ ├── account.hcl │ ├── ap-south-1 │ │ ├── ec2-instance │ │ │ ├── instance1 │ │ │ │ ├── key-pair.pub │ │ │ │ └── terragrunt.hcl │ │ │ └── instance2 │ │ │ ├── key-pair.pub │ │ │ └── terragrunt.hcl │ │ ├── network │ │ │ ├── tgw-route │ │ │ │ ├── tgw-route-vpc1 │ │ │ │ │ ├── main.tf │ │ │ │ │ └── terragrunt.hcl │ │ │ │ └── tgw-route-vpc2 │ │ │ │ ├── main.tf │ │ │ │ └── terragrunt.hcl │ │ │ ├── transit-gateway │ │ │ │ └── transit-peer │ │ │ │ └── terragrunt.hcl │ │ │ └── vpc │ │ │ ├── vpc1 │ │ │ │ └── terragrunt.hcl │ │ │ └── vpc2 │ │ │ └── terragrunt.hcl │ │ └── region.hcl └── terragrunt.hcl
Error: creating Security Group BASTION-VM2): InvalidVpcId.Malformed: The vpc ID 'mock-vpc-id' is malformed │ status code: 400, request id: ffa7fa8d-e489-4582-a7d5-9986cd617fe9 │ │ with module.security_group.aws_security_group.default[0], │ on .terraform/modules/security_group/main.tf line 27, in resource "aws_security_group" "default": │ 27: resource "aws_security_group" "default" { │ ╵ ╷ │ Error: creating Security Group (BASTION-VM): InvalidVpcId.Malformed: The vpc ID 'mock-vpc-id' is malformed │ status code: 400, request id: 134f4211-4f2f-4680-87cb-d1f2cdd42e45 │ │ with module.security_group.aws_security_group.default[0], │ on .terraform/modules/security_group/main.tf line 27, in resource "aws_security_group" "default": │ 27: resource "aws_security_group" "default" { │ ╵ Releasing state lock. This may take a few moments... ERRO[0100] terraform invocation failed in /home/aadi/cscaf-terraform-infra/sandbox-account/ap-south-1/ec2-instance/instance1/.terragrunt-cache/vvlkMM3RQpZp4fFRFn2aLwx0B8Y/kDR0sdsVyL47k-CUEDXVQyrNB0k prefix=[/home/aadi/cscaf-terraform-infra/sandbox-account/ap-south-1/ec2-instance/instance1] ERRO[0100] Module /home/aadi/cscaf-terraform-infra/sandbox-account/ap-south-1/ec2-instance/instance1 has finished with an error: 1 error occurred:
I want to apply based on a plan. So first I run
terragrunt run-all plan -out tf.plan
which works and puts atf.plan
file into every module directory.When I then try to run
terragrunt run-all apply tf.plan
it fails like this:The root cause seems to be the way how
terragrunt
callsterraform
:which fails with
because
terraform
expects the plan file to be the last command line argument, given after all the options.Am I doing something wrong here? My versions are:
My sources are in https://github.com/schlomo/chromebooks-in-deutschland/tree/cloudfront/aws