Skip to content

Commit

Permalink
Use 'tfresource.RetryWhenNotFound' in CreateTags.
Browse files Browse the repository at this point in the history
Acceptance test output:

% make testacc TESTARGS='-run=TestAccAWSEc2Tag_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEc2Tag_basic -timeout 180m
=== RUN   TestAccAWSEc2Tag_basic
=== PAUSE TestAccAWSEc2Tag_basic
=== CONT  TestAccAWSEc2Tag_basic
--- PASS: TestAccAWSEc2Tag_basic (643.11s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       646.359s
  • Loading branch information
ewbankkit committed Aug 20, 2021
1 parent 5689893 commit 49cc3e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
18 changes: 3 additions & 15 deletions aws/internal/keyvaluetags/create_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 3 additions & 15 deletions aws/internal/keyvaluetags/generators/createtags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,13 @@ func {{ . | Title }}CreateTags(conn {{ . | ClientType }}, identifier string{{ if
{{- if . | RetryCreationOnResourceNotFound }}
err := resource.Retry(EventualConsistencyTimeout, func() *resource.RetryError {
_, err := conn.{{ . | TagFunction }}(input)
_, err := tfresource.RetryWhenNotFound(EventualConsistencyTimeout, func() (interface{}, error) {
output, err := conn.{{ . | TagFunction }}(input)
{{ . | ParentResourceNotFoundError }}
if tfresource.NotFound(err) {
return resource.RetryableError(err)
}
if err != nil {
return resource.NonRetryableError(err)
}
return nil
return output, err
})
if tfresource.TimedOut(err) {
_, err = conn.{{ . | TagFunction }}(input)
}
{{- else }}
_, err := conn.{{ . | TagFunction }}(input)
{{- end }}
Expand Down

0 comments on commit 49cc3e2

Please sign in to comment.