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

Check target blocks are not nil #19946

Merged

Conversation

packrat386
Copy link
Contributor

@packrat386 packrat386 commented Jun 24, 2021

If nothing is specified for these blocks then they cannot be cast to map[string]interface.

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 #19945

Output from acceptance testing:

 [fg-386] terraform-provider-aws > AWS_PROFILE=sandbox TF_ACC=1 go test ./aws -v -run=TestAccAWSCloudWatchEventTarget
=== RUN   TestAccAWSCloudWatchEventTarget_basic
=== PAUSE TestAccAWSCloudWatchEventTarget_basic
=== RUN   TestAccAWSCloudWatchEventTarget_EventBusName
=== PAUSE TestAccAWSCloudWatchEventTarget_EventBusName
=== RUN   TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== PAUSE TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== RUN   TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== PAUSE TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== RUN   TestAccAWSCloudWatchEventTarget_full
=== PAUSE TestAccAWSCloudWatchEventTarget_full
=== RUN   TestAccAWSCloudWatchEventTarget_disappears
=== PAUSE TestAccAWSCloudWatchEventTarget_disappears
=== RUN   TestAccAWSCloudWatchEventTarget_ssmDocument
=== PAUSE TestAccAWSCloudWatchEventTarget_ssmDocument
=== RUN   TestAccAWSCloudWatchEventTarget_http
=== PAUSE TestAccAWSCloudWatchEventTarget_http
=== RUN   TestAccAWSCloudWatchEventTarget_ecs
=== PAUSE TestAccAWSCloudWatchEventTarget_ecs
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== RUN   TestAccAWSCloudWatchEventTarget_batch
=== PAUSE TestAccAWSCloudWatchEventTarget_batch
=== RUN   TestAccAWSCloudWatchEventTarget_kinesis
=== PAUSE TestAccAWSCloudWatchEventTarget_kinesis
=== RUN   TestAccAWSCloudWatchEventTarget_sqs
=== PAUSE TestAccAWSCloudWatchEventTarget_sqs
=== RUN   TestAccAWSCloudWatchEventTarget_input_transformer
=== PAUSE TestAccAWSCloudWatchEventTarget_input_transformer
=== RUN   TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== PAUSE TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== RUN   TestAccAWSCloudWatchEventTarget_PartnerEventBus
    resource_aws_cloudwatch_event_target_test.go:714: Environment variable EVENT_BRIDGE_PARTNER_EVENT_BUS_NAME is not set
--- SKIP: TestAccAWSCloudWatchEventTarget_PartnerEventBus (0.00s)
=== CONT  TestAccAWSCloudWatchEventTarget_basic
=== CONT  TestAccAWSCloudWatchEventTarget_disappears
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== CONT  TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (12.66s)
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
--- PASS: TestAccAWSCloudWatchEventTarget_basic (30.38s)
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (35.89s)
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (31.89s)
=== CONT  TestAccAWSCloudWatchEventTarget_batch
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (14.55s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType (54.97s)
=== CONT  TestAccAWSCloudWatchEventTarget_http
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (25.19s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecs
--- PASS: TestAccAWSCloudWatchEventTarget_http (15.16s)
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (54.69s)
=== CONT  TestAccAWSCloudWatchEventTarget_full
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (25.74s)
=== CONT  TestAccAWSCloudWatchEventTarget_GeneratedTargetId
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (11.12s)
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (12.12s)
=== CONT  TestAccAWSCloudWatchEventTarget_EventBusName
--- PASS: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (52.63s)
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (22.02s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (53.23s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (133.51s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       178.126s
...

If nothing is specified for these blocks then they cannot be cast to
`map[string]interface`.

reproduction: https://github.com/packrat386/tf_sqs_issue_repro
@github-actions github-actions bot added service/cloudwatchevents size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jun 24, 2021
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @packrat386 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@packrat386 packrat386 marked this pull request as ready for review June 24, 2021 15:42
@packrat386
Copy link
Contributor Author

The config I used to reproduce the error (linked in the issue) successfully applies with this version of the provider. I can add an acceptance test for this if we want, but it seems like a very narrow case (that probably nobody should be doing anyway) so I'll hold off unless y'all think it's worth it.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 28, 2021
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventTarget_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventTarget_ -timeout 180m
=== RUN   TestAccAWSCloudWatchEventTarget_basic
=== PAUSE TestAccAWSCloudWatchEventTarget_basic
=== RUN   TestAccAWSCloudWatchEventTarget_EventBusName
=== PAUSE TestAccAWSCloudWatchEventTarget_EventBusName
=== RUN   TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== PAUSE TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== RUN   TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== PAUSE TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== RUN   TestAccAWSCloudWatchEventTarget_full
=== PAUSE TestAccAWSCloudWatchEventTarget_full
=== RUN   TestAccAWSCloudWatchEventTarget_disappears
=== PAUSE TestAccAWSCloudWatchEventTarget_disappears
=== RUN   TestAccAWSCloudWatchEventTarget_ssmDocument
=== PAUSE TestAccAWSCloudWatchEventTarget_ssmDocument
=== RUN   TestAccAWSCloudWatchEventTarget_http
=== PAUSE TestAccAWSCloudWatchEventTarget_http
=== RUN   TestAccAWSCloudWatchEventTarget_ecs
=== PAUSE TestAccAWSCloudWatchEventTarget_ecs
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== RUN   TestAccAWSCloudWatchEventTarget_batch
=== PAUSE TestAccAWSCloudWatchEventTarget_batch
=== RUN   TestAccAWSCloudWatchEventTarget_kinesis
=== PAUSE TestAccAWSCloudWatchEventTarget_kinesis
=== RUN   TestAccAWSCloudWatchEventTarget_sqs
=== PAUSE TestAccAWSCloudWatchEventTarget_sqs
=== RUN   TestAccAWSCloudWatchEventTarget_input_transformer
=== PAUSE TestAccAWSCloudWatchEventTarget_input_transformer
=== RUN   TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== PAUSE TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== RUN   TestAccAWSCloudWatchEventTarget_PartnerEventBus
    resource_aws_cloudwatch_event_target_test.go:714: Environment variable EVENT_BRIDGE_PARTNER_EVENT_BUS_NAME is not set
--- SKIP: TestAccAWSCloudWatchEventTarget_PartnerEventBus (0.00s)
=== CONT  TestAccAWSCloudWatchEventTarget_basic
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
=== CONT  TestAccAWSCloudWatchEventTarget_batch
=== CONT  TestAccAWSCloudWatchEventTarget_disappears
=== CONT  TestAccAWSCloudWatchEventTarget_ecs
=== CONT  TestAccAWSCloudWatchEventTarget_http
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
=== CONT  TestAccAWSCloudWatchEventTarget_full
=== CONT  TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== CONT  TestAccAWSCloudWatchEventTarget_EventBusName
=== CONT  TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (20.25s)
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (21.44s)
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (24.59s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (24.68s)
--- PASS: TestAccAWSCloudWatchEventTarget_http (30.28s)
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (37.57s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (38.21s)
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (39.76s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (44.46s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (46.38s)
--- PASS: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (63.06s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (64.82s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (64.89s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (121.86s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
    testing_new.go:63: Error running post-test destroy, there may be dangling resources: exit status 1
        2021/06/28 11:09:33 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
        
        Error: Error deleting ECS cluster: ClusterContainsTasksException: The Cluster cannot be deleted while Tasks are active.
        
        
--- FAIL: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (288.73s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
    testing_new.go:63: Error running post-test destroy, there may be dangling resources: exit status 1
        2021/06/28 11:10:11 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
        
        Error: Error deleting ECS cluster: ClusterContainsTasksException: The Cluster cannot be deleted while Tasks are active.
        
        
--- FAIL: TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType (305.33s)

The failures are unrelated to this change and occur in nightly CI.

@ewbankkit
Copy link
Contributor

@packrat386 Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 4dc4476 into hashicorp:main Jun 28, 2021
@github-actions github-actions bot added this to the v3.48.0 milestone Jun 28, 2021
@github-actions
Copy link

github-actions bot commented Jul 8, 2021

This functionality has been released in v3.48.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

github-actions bot commented Aug 8, 2021

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 Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_cloudwatch_event_target panics if sqs_target block is empty
2 participants