Skip to content

Commit

Permalink
docs/contributing: Initial Retries and Waiters documentation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bflad committed Feb 8, 2021
1 parent 3f0a76b commit a560575
Show file tree
Hide file tree
Showing 3 changed files with 479 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ This documentation also contains reference material specific to certain function
- [Running and Writing Acceptance Tests](contributing/running-and-writing-acceptance-tests.md)
- [Data Handling and Conversion](contributing/data-handling-and-conversion.md)
- [Error Handling](contributing/error-handling.md)
- [Retries and Waiters](contributing/retries-and-waiters.md)
6 changes: 4 additions & 2 deletions docs/contributing/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ _Please Note: This documentation is intended for Terraform AWS Provider code dev

The Terraform AWS Provider codebase bridges the implementation of a [Terraform Plugin](https://www.terraform.io/docs/extend/how-terraform-works.html) and an AWS API client to support AWS operations and data types as Terraform Resources. An important aspect of performing resource and remote actions is properly handling those operations, but those operations are not guaranteed to succeed every time. Some common examples include where network connections are unreliable, necessary permissions are not properly setup, incorrect Terraform configurations, or the remote system responds unexpectedly. All these situations lead to an unexpected workflow action that must be surfaced to the Terraform user interface for operators to troubleshoot. This guide is intended to explain and show various Terraform AWS Provider code implementations that are considered best practice for surfacing these issues properly to operators and code maintainers.

For further details about how the AWS Go SDK and the Terraform AWS Provider resource logic handle retryable errors, see the [Retries and Waiters documentation](retries-and-waiters.md).

- [General Guidelines and Helpers](#general-guidelines-and-helpers)
- [Naming and Check Style](#naming-and-check-style)
- [Wrap Errors](#wrap-errors)
Expand Down Expand Up @@ -200,7 +202,7 @@ func resourceServiceThingRead(d *schema.ResourceData, meta interface{}) error {
}
```

Future documentation will show how to properly retry the remote operation for a short period of time until it is successful to remove the error completely.
If the remote system is not strongly read-after-write consistent, see the [Retries and Waiters documentation on Resource Lifecycle Retries](retries-and-waiters.md#resource-lifecycle-retries) to further understand how to handle these situations and prevent these types of errors.

#### Creation Error Message Context

Expand Down Expand Up @@ -276,7 +278,7 @@ if err != nil {
}
```

Code that also uses waiters or other operations that return errors should follow a similar pattern:
Code that also uses [waiters](retries-and-waiters.md) or other operations that return errors should follow a similar pattern:

```go
if _, err := waiter.VpcDeleted(conn, d.Id()); err != nil {
Expand Down
Loading

0 comments on commit a560575

Please sign in to comment.