Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make terraform init cancellable #23647

Open
radeksimko opened this issue Dec 11, 2019 · 4 comments
Open

Make terraform init cancellable #23647

radeksimko opened this issue Dec 11, 2019 · 4 comments

Comments

@radeksimko
Copy link
Member

Terraform Version

v0.12.18

Terraform Configuration Files

provider "aws" {
  region = "eu-west-1"
}

Expected Behavior

Discovery of providers should be cancelled when SIGINT is received.

Actual Behavior

Discovery continues.

$ terraform init

Initializing the backend...

Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.41.0...
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 2.41"

Terraform has been successfully initialized!

Steps to Reproduce

terraform init

References

hashicorp/terraform-plugin-sdk#141

@apparentlymart
Copy link
Contributor

I've merged #26405 which makes the provider installation part of terraform init respond to SIGINT. The phrasing of this issue seems more general than just the provider installation part, and so I've not closed it because the backend initialization and module installation parts are still not cancelable.

@stigok
Copy link

stigok commented Dec 7, 2020

It would make sense to make the plan phase of plan and apply also be cancellable, I think.

@radeksimko
Copy link
Member Author

@stigok It may be better to discuss and track that in a separate thread, because there is already many operations which run as part of init and there is likely even more in plan and especially apply and cancellation ability of every operation may differ, so this would need to be considered.

Relatedly it's possible that making apply/plan/destroy reliably cancellable would involve some SDK and provider work and unlike init likely can't be just implemented in core alone.

@radeksimko
Copy link
Member Author

@apparentlymart I think downloading would usually take the most time, so that helps a lot, but it would still be useful to make the initial discovery cancellable too - for example to tackle DNS or proxy issues when the first request just hangs and eventually times out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants