Terraform v0.11.7
+ provider.aws v1.14.1
The resource configuration doesn't seem likely to be relevant, but we are using remote S3 state:
data "terraform_remote_state" "payment" {
backend = "s3"
config {
bucket = "REDACTED"
key = "REDACTED"
region = "us-east-1"
encrypt = "true"
dynamodb_table = "terraform-state-lock"
}
}
https://gist.github.com/sgrimm-sg/42c73d35d1a52b1701e6fdfea401778c
N/A
Hitting control-C during terraform plan should exit immediately, perhaps after doing whatever cleanup it needs to do.
A message is immediately printed saying the command is shutting down, but it continues to run to completion, refreshing all the resources from AWS and then printing the plan.
With an AWS configuration of nontrivial size, such that it takes substantial time to refresh, and with remote state:
terraform plan -out=/tmp/plan
Hit control-C early on, before it starts printing messages about refreshing resources. Then observe that the entire refresh runs.
Running Terraform on OS X High Sierra.
Pretty much every Go program I've ever used has terrible cancellation. Seems par for the course.
Thanks for reporting this, @sgrimm-sg!
Currently the same cancellation mechanism is used for all Terraform commands, but you're right that in principle the terraform plan command could have a more "graceless" shutdown since it doesn't have any externally-visible side-effects. We're hoping to shift our focus to UI-ish work after the next major release (which is focused on configuration language) and so I'd like to spend some more time investigating this when we get there.
I'm a bit confused about https://github.com/hashicorp/terraform/issues/16571 being closed.
Technically we still can not interrupt terraform plan on some stages, so one needs to force-close it.
Can we at least get a better message than the FUD-inducing Please wait for Terraform to exit or data loss may occur? Sometimes it's just not an option to wait for Terraform to exit, e.g. network connectivity problems meaning it will never finish refreshing. In that case it is urgently important to inform the developer of what will actually happen if the process is interrupted. And if it's actually possible for data loss to occur during a read-only plan operation, something seems seriously, urgently, the-world-is-on-fire wrong with Terraform. That could happen for a million different reasons, e.g. terminal emulator crashes, accidental keypress, wifi cut out, battery died, etc. This is especially important because if your Terraform state gets corrupted, you are extremely screwed due to the complete lack of any bulk import support. I am confused why this issue has not been prioritized.
The current master branch and upcoming 0.14 release will no longer use a separate refresh walk, which means this specific issue will no longer be a concern.
Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
The current master branch and upcoming 0.14 release will no longer use a separate refresh walk, which means this specific issue will no longer be a concern.
Thanks!