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

r/aws_synthetics_canary: Correctly report creation errors #20463

Merged
merged 3 commits into from
Aug 6, 2021

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Aug 6, 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 #18636.
Closes #18616.

The underlying problem was the retry logic around create - The error code wasn't being checked which meant that resourceAwsSyntheticsCanaryRead() (and hence finder.CanaryByName()) was being called when d.SetId() hadn't.
After correcting that, the underlying acceptance tests errors were all related to an out-of-date runtime.

Output from acceptance testing:

Commercial

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSyntheticsCanary_'     
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSyntheticsCanary_ -timeout 180m
=== RUN   TestAccAWSSyntheticsCanary_basic
=== PAUSE TestAccAWSSyntheticsCanary_basic
=== RUN   TestAccAWSSyntheticsCanary_runtimeVersion
=== PAUSE TestAccAWSSyntheticsCanary_runtimeVersion
=== RUN   TestAccAWSSyntheticsCanary_startCanary
=== PAUSE TestAccAWSSyntheticsCanary_startCanary
=== RUN   TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== PAUSE TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== RUN   TestAccAWSSyntheticsCanary_s3
=== PAUSE TestAccAWSSyntheticsCanary_s3
=== RUN   TestAccAWSSyntheticsCanary_runConfig
=== PAUSE TestAccAWSSyntheticsCanary_runConfig
=== RUN   TestAccAWSSyntheticsCanary_runConfigTracing
=== PAUSE TestAccAWSSyntheticsCanary_runConfigTracing
=== RUN   TestAccAWSSyntheticsCanary_vpc
=== PAUSE TestAccAWSSyntheticsCanary_vpc
=== RUN   TestAccAWSSyntheticsCanary_tags
=== PAUSE TestAccAWSSyntheticsCanary_tags
=== RUN   TestAccAWSSyntheticsCanary_disappears
=== PAUSE TestAccAWSSyntheticsCanary_disappears
=== CONT  TestAccAWSSyntheticsCanary_basic
=== CONT  TestAccAWSSyntheticsCanary_runConfigTracing
=== CONT  TestAccAWSSyntheticsCanary_disappears
=== CONT  TestAccAWSSyntheticsCanary_vpc
=== CONT  TestAccAWSSyntheticsCanary_tags
=== CONT  TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== CONT  TestAccAWSSyntheticsCanary_runConfig
=== CONT  TestAccAWSSyntheticsCanary_runtimeVersion
=== CONT  TestAccAWSSyntheticsCanary_startCanary
=== CONT  TestAccAWSSyntheticsCanary_s3
--- PASS: TestAccAWSSyntheticsCanary_disappears (48.46s)
--- PASS: TestAccAWSSyntheticsCanary_s3 (67.11s)
--- PASS: TestAccAWSSyntheticsCanary_basic (93.51s)
--- PASS: TestAccAWSSyntheticsCanary_runConfigTracing (96.91s)
--- PASS: TestAccAWSSyntheticsCanary_startCanary_codeChanges (97.36s)
--- PASS: TestAccAWSSyntheticsCanary_tags (99.72s)
--- PASS: TestAccAWSSyntheticsCanary_runtimeVersion (101.69s)
--- PASS: TestAccAWSSyntheticsCanary_startCanary (102.51s)
--- PASS: TestAccAWSSyntheticsCanary_runConfig (114.58s)
--- PASS: TestAccAWSSyntheticsCanary_vpc (673.82s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	676.924s

GovCloud

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSyntheticsCanary_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSyntheticsCanary_ -timeout 180m
=== RUN   TestAccAWSSyntheticsCanary_basic
=== PAUSE TestAccAWSSyntheticsCanary_basic
=== RUN   TestAccAWSSyntheticsCanary_runtimeVersion
=== PAUSE TestAccAWSSyntheticsCanary_runtimeVersion
=== RUN   TestAccAWSSyntheticsCanary_startCanary
=== PAUSE TestAccAWSSyntheticsCanary_startCanary
=== RUN   TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== PAUSE TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== RUN   TestAccAWSSyntheticsCanary_s3
=== PAUSE TestAccAWSSyntheticsCanary_s3
=== RUN   TestAccAWSSyntheticsCanary_runConfig
=== PAUSE TestAccAWSSyntheticsCanary_runConfig
=== RUN   TestAccAWSSyntheticsCanary_runConfigTracing
=== PAUSE TestAccAWSSyntheticsCanary_runConfigTracing
=== RUN   TestAccAWSSyntheticsCanary_vpc
=== PAUSE TestAccAWSSyntheticsCanary_vpc
=== RUN   TestAccAWSSyntheticsCanary_tags
=== PAUSE TestAccAWSSyntheticsCanary_tags
=== RUN   TestAccAWSSyntheticsCanary_disappears
=== PAUSE TestAccAWSSyntheticsCanary_disappears
=== CONT  TestAccAWSSyntheticsCanary_basic
=== CONT  TestAccAWSSyntheticsCanary_runConfigTracing
=== CONT  TestAccAWSSyntheticsCanary_startCanary_codeChanges
=== CONT  TestAccAWSSyntheticsCanary_s3
=== CONT  TestAccAWSSyntheticsCanary_disappears
=== CONT  TestAccAWSSyntheticsCanary_tags
=== CONT  TestAccAWSSyntheticsCanary_vpc
=== CONT  TestAccAWSSyntheticsCanary_runtimeVersion
=== CONT  TestAccAWSSyntheticsCanary_runConfig
=== CONT  TestAccAWSSyntheticsCanary_startCanary
--- PASS: TestAccAWSSyntheticsCanary_disappears (63.68s)
--- PASS: TestAccAWSSyntheticsCanary_s3 (70.33s)
--- PASS: TestAccAWSSyntheticsCanary_tags (107.20s)
--- PASS: TestAccAWSSyntheticsCanary_basic (108.20s)
--- PASS: TestAccAWSSyntheticsCanary_runConfigTracing (108.31s)
--- PASS: TestAccAWSSyntheticsCanary_runtimeVersion (108.56s)
--- PASS: TestAccAWSSyntheticsCanary_startCanary_codeChanges (116.20s)
--- PASS: TestAccAWSSyntheticsCanary_runConfig (117.67s)
--- PASS: TestAccAWSSyntheticsCanary_startCanary (121.42s)
--- PASS: TestAccAWSSyntheticsCanary_vpc (1788.64s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1791.753s

Error: error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found.
- minimum field size of 1, GetCanaryInput.Name.

Acceptance test output:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSyntheticsCanary_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSyntheticsCanary_basic -timeout 180m
=== RUN   TestAccAWSSyntheticsCanary_basic
=== PAUSE TestAccAWSSyntheticsCanary_basic
=== CONT  TestAccAWSSyntheticsCanary_basic
    resource_aws_synthetics_canary_test.go:83: Step 1/3 error: Error running apply: exit status 1

        Error: error creating Synthetics Canary (tf-acc-test-lhi0ieu0): ValidationException: Deprecated runtime version specified.

          with aws_synthetics_canary.test,
          on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test":
          92: resource "aws_synthetics_canary" "test" {

--- FAIL: TestAccAWSSyntheticsCanary_basic (16.35s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	19.448s
FAIL
make: *** [testacc] Error 1
Acceptance test output:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSyntheticsCanary_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSyntheticsCanary_basic -timeout 180m
=== RUN   TestAccAWSSyntheticsCanary_basic
=== PAUSE TestAccAWSSyntheticsCanary_basic
=== CONT  TestAccAWSSyntheticsCanary_basic
--- PASS: TestAccAWSSyntheticsCanary_basic (87.73s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	91.049s
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. service/synthetics Issues and PRs that pertain to the synthetics service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Aug 6, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@anGie44 anGie44 added the bug Addresses a defect in current functionality. label Aug 6, 2021
@ewbankkit ewbankkit merged commit f05e452 into main Aug 6, 2021
@ewbankkit ewbankkit deleted the t-aws_synthetics_canary-test-failures branch August 6, 2021 17:10
@github-actions github-actions bot added this to the v3.54.0 milestone Aug 6, 2021
github-actions bot pushed a commit that referenced this pull request Aug 6, 2021
@github-actions
Copy link

This functionality has been released in v3.54.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Sep 12, 2021
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. service/synthetics Issues and PRs that pertain to the synthetics service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
2 participants