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

Cleaning up some resource retries for cloudwatch functions #9065

Merged
merged 6 commits into from
Jul 17, 2019

Conversation

ryndaniels
Copy link
Contributor

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Related #7873

Release note for CHANGELOG:

BUG FIXES:
* resource/aws_cloudwatch_event_permissions: Clean up error handling when reading event permissions
* resource/aws_cloudwatch_event_rule: Retry error handling when creating and updating event rules
* resource/aws_cloudwatch_log_destination: Clean up error handling when putting log destination
* resource/aws_cloudwatch_log_subscription_filter: Clean up error handling when creating log subscription filter

Output from acceptance testing:

make testacc TESTARGS="-run=TestAccAWSCloudwatchLogDestination"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudwatchLogDestination -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSCloudwatchLogDestinationPolicy_importBasic
=== PAUSE TestAccAWSCloudwatchLogDestinationPolicy_importBasic
=== RUN   TestAccAWSCloudwatchLogDestinationPolicy_basic
=== PAUSE TestAccAWSCloudwatchLogDestinationPolicy_basic
=== RUN   TestAccAWSCloudwatchLogDestination_importBasic
=== PAUSE TestAccAWSCloudwatchLogDestination_importBasic
=== RUN   TestAccAWSCloudwatchLogDestination_basic
=== PAUSE TestAccAWSCloudwatchLogDestination_basic
=== CONT  TestAccAWSCloudwatchLogDestinationPolicy_importBasic
=== CONT  TestAccAWSCloudwatchLogDestination_importBasic
=== CONT  TestAccAWSCloudwatchLogDestinationPolicy_basic
=== CONT  TestAccAWSCloudwatchLogDestination_basic
--- PASS: TestAccAWSCloudwatchLogDestinationPolicy_basic (118.58s)
--- PASS: TestAccAWSCloudwatchLogDestinationPolicy_importBasic (121.74s)
--- PASS: TestAccAWSCloudwatchLogDestination_importBasic (124.64s)
--- PASS: TestAccAWSCloudwatchLogDestination_basic (125.22s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       127.614s

make testacc TESTARGS="-run=TestAccAWSCloudWatchEventRule"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventRule -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSCloudWatchEventRule_importBasic
=== PAUSE TestAccAWSCloudWatchEventRule_importBasic
=== RUN   TestAccAWSCloudWatchEventRule_basic
=== PAUSE TestAccAWSCloudWatchEventRule_basic
=== RUN   TestAccAWSCloudWatchEventRule_prefix
=== PAUSE TestAccAWSCloudWatchEventRule_prefix
=== RUN   TestAccAWSCloudWatchEventRule_tags
=== PAUSE TestAccAWSCloudWatchEventRule_tags
=== RUN   TestAccAWSCloudWatchEventRule_full
=== PAUSE TestAccAWSCloudWatchEventRule_full
=== RUN   TestAccAWSCloudWatchEventRule_enable
=== PAUSE TestAccAWSCloudWatchEventRule_enable
=== CONT  TestAccAWSCloudWatchEventRule_importBasic
=== CONT  TestAccAWSCloudWatchEventRule_full
=== CONT  TestAccAWSCloudWatchEventRule_basic
=== CONT  TestAccAWSCloudWatchEventRule_enable
=== CONT  TestAccAWSCloudWatchEventRule_tags
=== CONT  TestAccAWSCloudWatchEventRule_prefix
--- PASS: TestAccAWSCloudWatchEventRule_prefix (27.20s)
--- PASS: TestAccAWSCloudWatchEventRule_full (27.41s)
--- PASS: TestAccAWSCloudWatchEventRule_importBasic (29.77s)
--- PASS: TestAccAWSCloudWatchEventRule_basic (47.79s)
--- PASS: TestAccAWSCloudWatchEventRule_enable (68.30s)
--- PASS: TestAccAWSCloudWatchEventRule_tags (72.23s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       74.035s

make testacc TESTARGS="-run=TestAccAWSCloudwatchLogSubscriptionFilter"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudwatchLogSubscriptionFilter -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_disappears
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_disappears
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_disappears
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears (46.10s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup (46.17s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_basic (46.65s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       49.312s

make testacc TESTARGS="-run=TestAccAWSCloudWatchEventPermission"==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventPermission -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSCloudWatchEventPermission_Basic
=== PAUSE TestAccAWSCloudWatchEventPermission_Basic
=== RUN   TestAccAWSCloudWatchEventPermission_Action
=== PAUSE TestAccAWSCloudWatchEventPermission_Action
=== RUN   TestAccAWSCloudWatchEventPermission_Condition
=== PAUSE TestAccAWSCloudWatchEventPermission_Condition
=== RUN   TestAccAWSCloudWatchEventPermission_Multiple
=== PAUSE TestAccAWSCloudWatchEventPermission_Multiple
=== RUN   TestAccAWSCloudWatchEventPermission_Disappears
=== PAUSE TestAccAWSCloudWatchEventPermission_Disappears
=== CONT  TestAccAWSCloudWatchEventPermission_Basic
=== CONT  TestAccAWSCloudWatchEventPermission_Multiple
=== CONT  TestAccAWSCloudWatchEventPermission_Action
=== CONT  TestAccAWSCloudWatchEventPermission_Condition
=== CONT  TestAccAWSCloudWatchEventPermission_Disappears
--- PASS: TestAccAWSCloudWatchEventPermission_Action (24.19s)
--- PASS: TestAccAWSCloudWatchEventPermission_Multiple (39.32s)
--- PASS: TestAccAWSCloudWatchEventPermission_Basic (40.09s)
--- PASS: TestAccAWSCloudWatchEventPermission_Condition (40.25s)
--- PASS: TestAccAWSCloudWatchEventPermission_Disappears (80.30s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       81.191s

@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/cloudwatchlogs labels Jun 20, 2019
@ryndaniels ryndaniels requested a review from bflad June 20, 2019 12:56
@ryndaniels ryndaniels added the bug Addresses a defect in current functionality. label Jun 20, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Some minor changes needed below then we can retest this. 👍

aws/resource_aws_cloudwatch_log_destination.go Outdated Show resolved Hide resolved
aws/resource_aws_cloudwatch_log_destination.go Outdated Show resolved Hide resolved
aws/resource_aws_cloudwatch_log_subscription_filter.go Outdated Show resolved Hide resolved
@ryndaniels ryndaniels requested a review from a team June 21, 2019 15:03
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jun 21, 2019
@bflad bflad added this to the v2.17.0 milestone Jun 21, 2019

err = resource.Retry(1*time.Minute, func() *resource.RetryError {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how I missed this the first lookthrough, but the addition of this new resource.Retry() is extraneous here and will never pass after retries. The original intention of the retry logic was to treat completely a missing policy and a policy missing the new statement as the same for retries. This logic should all be contained in one big retry function as it was originally or split into its own function so the isResourceTimeoutError() implementation is easier. 👍

@bflad bflad removed their assignment Jun 25, 2019
@bflad bflad modified the milestones: v2.17.0, v2.18.0 Jun 27, 2019
@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Jul 5, 2019
@bflad bflad modified the milestones: v2.18.0, v2.19.0 Jul 5, 2019
@bflad bflad self-requested a review July 5, 2019 18:59
@bflad bflad modified the milestones: v2.19.0, v2.20.0 Jul 11, 2019
@ryndaniels
Copy link
Contributor Author

@bflad any other changes you'd like to see to this?

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for sticking through this one. 🚀

--- PASS: TestAccAWSCloudWatchEventPermission_Action (9.19s)
--- PASS: TestAccAWSCloudWatchEventPermission_Basic (17.05s)
--- PASS: TestAccAWSCloudWatchEventPermission_Condition (14.73s)
--- PASS: TestAccAWSCloudWatchEventPermission_Disappears (69.44s)
--- PASS: TestAccAWSCloudWatchEventPermission_Multiple (14.49s)

--- PASS: TestAccAWSCloudWatchEventRule_basic (19.15s)
--- PASS: TestAccAWSCloudWatchEventRule_enable (26.67s)
--- PASS: TestAccAWSCloudWatchEventRule_full (12.55s)
--- PASS: TestAccAWSCloudWatchEventRule_importBasic (14.36s)
--- PASS: TestAccAWSCloudWatchEventRule_prefix (11.59s)
--- PASS: TestAccAWSCloudWatchEventRule_tags (29.49s)

--- PASS: TestAccAWSCloudwatchLogDestination_basic (101.51s)
--- PASS: TestAccAWSCloudwatchLogDestination_importBasic (107.48s)

--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_basic (36.08s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears (33.58s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup (33.42s)

@ryndaniels ryndaniels merged commit d5e098b into master Jul 17, 2019
@ryndaniels ryndaniels deleted the rfd-retry-cloudwatch branch July 17, 2019 16:55
@ghost
Copy link

ghost commented Nov 2, 2019

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 and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants