terragrunt
terragrunt copied to clipboard
Send ctrl+c one time but terragrunt send twice to terraform
Sorry that might be a stupid question. When I abort the apply when resource is being created via ctrl+c one time(want it to be gracefully shutdown), terragrunt send twice to terraform so there is no gracefully shutdown and result in state lock not being released and the hash value in the table would be mismatch even I run force-unlock. May I know is it the design or only my laptop encounter this issue.
^C
Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...
Two interrupts received. Exiting immediately. Note that data loss may have
occurred.
╷
│ Error: operation canceled
terragrunt version v0.37.1 Terraform v1.2.1 on darwin_amd64
- provider registry.terraform.io/hashicorp/aws v4.15.1
- provider registry.terraform.io/hashicorp/cloudinit v2.2.0
- provider registry.terraform.io/hashicorp/kubernetes v2.11.0
- provider registry.terraform.io/hashicorp/local v2.2.3
- provider registry.terraform.io/hashicorp/tls v3.4.0
I've experienced the same issue several times.
terragrunt version v0.36.7 on linux
I also experience this. terragrunt version 0.36.10, terraform version 1.1.9
I see this in both VS Code terminal and Windows terminal. I'm using zsh
in both places, and the underlying system is Ubuntu 2004 on amd64.
Terragrunt v0.39.0 Terraform v1.3.1 darwin_arm64
Still happening for me. Terragrunt: v0.42.2 Terraform: v1.3.6 OSX: 12.6.1
Ctrl-C sends a SIGINT to all processes in the process group (terragrunt, terraform, etc), terragrunt's signal forwarding causes a second SIGINT to the child process: https://github.com/gruntwork-io/terragrunt/blob/c85212fe2dc1bfb524396d08caca69f9124057e8/shell/run_shell_cmd.go#L178-L198
kill -SIGINT $PID
works as expected. (one SIGINT, forwarded by the terragrunt process)
https://unix.stackexchange.com/a/149756
To workaround this issue, we leverage the terraform_binary
configuration option to use a script that puts the Terraform invocation into a new process group. This prevents the Ctrl+C SIGINT from the terminal being sent to the Terraform command. Perhaps a similar behaviour is needed within the command exec invocation inside Terragrunt?
Issue resolved in v0.45.11 release.