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

Integrate Provider Context For Cancelling Requests #4177

Closed
bflad opened this issue Apr 11, 2018 · 6 comments
Closed

Integrate Provider Context For Cancelling Requests #4177

bflad opened this issue Apr 11, 2018 · 6 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. stale Old or inactive issues managed by automation, if no further action taken these will get closed. technical-debt Addresses areas of the codebase that need refactoring or redesign.

Comments

@bflad
Copy link
Contributor

bflad commented Apr 11, 2018

Description

In order to properly cancel a Terraform command, we need to reference the provider context to any AWS Go SDK calls and separately any Terraform Plugin SDK retry loops. In Terraform Plugin SDK version 2, the provider context is available via new CRUD function signatures (e.g. CreateContext) (#15090) which will be the starting point for any implementation.

Then when its available to the resources:

  • Decide if resource.RetryContext()/WaitForStateContext() should be done as part of this effort or not. Likely separately as it can have its own set of linters.
  • Passthrough the provider context.Context to any necessary downstream functions (if not a resource function) that call the AWS Go SDK (and resource.Retry()/StateChangeConf if necessary) -- this also includes generating context-aware keyvaluetags functionality
  • If AWS Go SDK is still version 1 for all resources, switch the AWS SDK calls to their WithContext variant and pass through the available resource context.Context to them
  • If AWS Go SDK is version 2 for new resources, document the appropriate code steps
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. technical-debt Addresses areas of the codebase that need refactoring or redesign. provider Pertains to the provider itself, rather than any interaction with AWS. labels Apr 11, 2018
@bflad
Copy link
Contributor Author

bflad commented Sep 14, 2020

Terraform Plugin SDK version 2 introduces CRUD functions (e.g. CreateContext) with the provider context automatically available (#15090) -- will adjust the description of this issue. Depending on the timing of that work and the GA release of AWS Go SDK version 2, the implementation details may change further.

@bflad bflad changed the title Integrate Provider StopContext For Cancelling Requests Integrate Provider Context For Cancelling Requests Sep 14, 2020
@bflad
Copy link
Contributor Author

bflad commented Sep 21, 2020

One potential risk to threading the resource context through to all functionality is ensuring that the default resource timeouts (20 minutes) do not interfere with the provider-level max_retries (AWS Go SDK MaxRetries) setting (which defaults to 25 and ~60 minutes). We may not have a choice if it does, but it will be helpful to understand and document the behavior before migrating code to the new goodness, potentially in a major release.

@bflad
Copy link
Contributor Author

bflad commented Mar 25, 2021

The risk mentioned above is now mitigated with *WithoutTimeout functionality -- the Terraform Plugin SDK v2 function signature migration can be tracked in #15090

Will add internal/keyvaluetags: Generate Context-Aware Functions to the description.

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 15, 2023
@ewbankkit
Copy link
Contributor

Closed by #29005.

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. stale Old or inactive issues managed by automation, if no further action taken these will get closed. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

No branches or pull requests

2 participants