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

docs/contributing: Initial Retries and Waiters documentation #17508

Merged
merged 6 commits into from
Feb 10, 2021

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 8, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #12844
Closes #15792
Reference: #16796

This page is meant to serve as a reference for all the related retry and waiting logic present in the provider. Further enhancements could discuss resource timeouts in general, however there is some future uncertainty with that functionality so it is currently omitted.

Output from acceptance testing: N/A (documentation)

Reference: #12844
Reference: #15792
Reference: #16796

This page is meant to serve as a reference for all the related retry and waiting logic present in the provider. Further enhancements could discuss resource timeouts in general, however there is some future uncertainty with that functionality so it is currently omitted.
@bflad bflad requested a review from a team as a code owner February 8, 2021 18:00
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. labels Feb 8, 2021
@YakDriver YakDriver self-assigned this Feb 8, 2021

const (
// Maximum amount of time to wait for Example eventual consistency on creation
ExampleCreationTimeout = 2 * time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Example is the service name and we are in a service-specific package, should this be CreationTimeout = 2 * time.Minute instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.


const (
// Maximum amount of time to wait for Example eventual consistency
ExampleTimeout = 2 * time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Example is the service name and we are in a service-specific package, should this be PropagationTimeout = 2 * time.Minute instead (like it is for IAM)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.

Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code examples are the real gems here. I selfishly dived into the text to really understand it and hopefully clarify it a little.

@@ -172,7 +171,7 @@ Each AWS service API (and sometimes even operations within the same API) varies

import (
// ... other imports ...
// By convention, cross-service waiter imports are named {SERVICE}waiter
// By convention, cross-service waiter imports are aliased as {SERVICE}waiter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nooice

docs/contributing/error-handling.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved

### State Change Configuration and Functions

The [`resource.StateChangeConf` type](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf) along with its receiver methods [`WaitForState()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForState) and [`WaitForStateContext()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForStateContext) is a generic primitive for repeating operations in Terraform resource logic until desired value(s) are received. The "state change" in this case is generic to any value and not specific to the Terraform State. Among other functionality, it supports some of these desirable optional properties:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [`resource.StateChangeConf` type](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf) along with its receiver methods [`WaitForState()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForState) and [`WaitForStateContext()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForStateContext) is a generic primitive for repeating operations in Terraform resource logic until desired value(s) are received. The "state change" in this case is generic to any value and not specific to the Terraform State. Among other functionality, it supports some of these desirable optional properties:
The [`resource.StateChangeConf` type](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf) along with its receiver methods [`WaitForState()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForState) and [`WaitForStateContext()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#StateChangeConf.WaitForStateContext) is a generic primitive for repeating operations in a Terraform resource until it receives desired values. The "state change," in this case, refers to values the Provider receives from AWS and not specifically the Terraform state. Among other capabilities, the type supports this particularly desirable yet optional functionality:

docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
docs/contributing/retries-and-waiters.md Outdated Show resolved Hide resolved
bflad and others added 2 commits February 10, 2021 10:10
Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com>
Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
@bflad bflad merged commit 51c7793 into main Feb 10, 2021
@bflad bflad deleted the d-contributing-retries-and-waiters branch February 10, 2021 15:27
@github-actions github-actions bot added this to the v3.28.0 milestone Feb 10, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

This has been released in version 3.28.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 12, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. size/XL Managed by automation to categorize the size of a PR.
Projects
None yet
3 participants