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

Allow empty string as valid setting for launch_type in CloudWatchEventTarget #19555

Merged
merged 7 commits into from
Jun 10, 2021
Merged

Allow empty string as valid setting for launch_type in CloudWatchEventTarget #19555

merged 7 commits into from
Jun 10, 2021

Conversation

ianneub
Copy link
Contributor

@ianneub ianneub commented May 27, 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

Relates #16078

Output from acceptance testing:

$ make testacc 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_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:673: Environment variable EVENT_BRIDGE_PARTNER_EVENT_BUS_NAME is not set
--- SKIP: TestAccAWSCloudWatchEventTarget_PartnerEventBus (0.00s)
=== CONT  TestAccAWSCloudWatchEventTarget_basic
=== CONT  TestAccAWSCloudWatchEventTarget_ecs
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
=== CONT  TestAccAWSCloudWatchEventTarget_full
=== CONT  TestAccAWSCloudWatchEventTarget_http
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
=== CONT  TestAccAWSCloudWatchEventTarget_disappears
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
=== CONT  TestAccAWSCloudWatchEventTarget_inputTransformerJsonString
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== CONT  TestAccAWSCloudWatchEventTarget_EventBusName
=== CONT  TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== CONT  TestAccAWSCloudWatchEventTarget_batch
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (59.81s)
--- PASS: TestAccAWSCloudWatchEventTarget_http (93.22s)
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (141.61s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (156.11s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (160.64s)
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (162.59s)
--- PASS: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (163.23s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (163.35s)
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (166.32s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (167.78s)
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (168.02s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (174.26s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (177.12s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (186.24s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (248.19s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	251.042s

@ianneub ianneub requested a review from a team as a code owner May 27, 2021 19:28
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. labels May 27, 2021
@github-actions github-actions bot added service/cloudwatchevents needs-triage Waiting for first response or review from a maintainer. labels May 27, 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 @ianneub 👋

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! 😃

@ianneub ianneub changed the title Allow empty string as valid setting for launch_type. Fixes #16078 Allow empty string as valid setting for launch_type May 27, 2021
@ianneub ianneub changed the title Allow empty string as valid setting for launch_type Allow empty string as valid setting for launch_type in CloudWatchEventTarget May 27, 2021
@ianneub ianneub changed the title Allow empty string as valid setting for launch_type in CloudWatchEventTarget [WIP] Allow empty string as valid setting for launch_type in CloudWatchEventTarget May 27, 2021
@ianneub ianneub marked this pull request as draft May 27, 2021 19:51
@ianneub ianneub changed the title [WIP] Allow empty string as valid setting for launch_type in CloudWatchEventTarget Allow empty string as valid setting for launch_type in CloudWatchEventTarget May 27, 2021
@ianneub ianneub marked this pull request as ready for review May 27, 2021 19:56
@anGie44 anGie44 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. service/eventbridge labels Jun 10, 2021
.changelog/19555.txt Outdated Show resolved Hide resolved
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.

Hi @ianneub, this is off to a great start! Just small comments to address.

Also, do you mind adding in a new acceptance test to validate creation with an empty string as well as updating from non-empty to empty? Feel free to reach out if you have any questions or if you're not readily available at this time, just drop a note and I'd be happy to continue the work here 😃

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Jun 10, 2021
@ianneub
Copy link
Contributor Author

ianneub commented Jun 10, 2021

Thanks for checking this PR out @anGie44 . I've updated the PR with the following changes:

  1. A new acceptance test and a tweak to the existing test
  2. Tweaked the changelog entry
  3. I had to modify your change to aws/resource_aws_cloudwatch_event_target.go on lines 146 - 148 as gofmt's was complaining about the indentation.

Please let me know if you have any suggestions to improve the PR.

After running my tests I get the following output:

$ ACCTEST_PARALLELISM=1 AWS_PROFILE=default make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_ecs'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 1 -run=TestAccAWSCloudWatchEventTarget_ecs -timeout 180m
=== RUN   TestAccAWSCloudWatchEventTarget_ecs
=== PAUSE TestAccAWSCloudWatchEventTarget_ecs
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
=== RUN   TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== PAUSE TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== CONT  TestAccAWSCloudWatchEventTarget_ecs
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (37.67s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (25.03s)
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType (24.97s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	89.522s

@ianneub ianneub requested a review from anGie44 June 10, 2021 02:21
@ianneub
Copy link
Contributor Author

ianneub commented Jun 10, 2021

Thanks @anGie44 . I believe those changes are good to go, however this is my first commit to Terraform. Please let me know if you have any other suggestions to make it better.

@anGie44 anGie44 added this to the v3.45.0 milestone Jun 10, 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.

Great work @ianneub ! Only non-code change i'll make is update the description to Relate to the original issue instead of Fix since i think the issue is a valid breaking-change we should address in a major release.

Output of acceptance tests (commercial):

--- SKIP: TestAccAWSCloudWatchEventTarget_PartnerEventBus (0.00s)
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (35.61s)
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (39.84s)
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (42.10s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (45.21s)
--- PASS: TestAccAWSCloudWatchEventTarget_http (48.44s)
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (56.68s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (58.01s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (58.04s)
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (62.05s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (68.45s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (73.92s)
--- PASS: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (78.43s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (80.06s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (81.19s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankLaunchType (89.42s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (100.35s)

Update: I missed to mention we should update the documentation as well to be more explicit about this empty string option! I'll add this in 👍

@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Jun 10, 2021
@anGie44 anGie44 merged commit 8405b41 into hashicorp:main Jun 10, 2021
@ianneub ianneub deleted the allow-empty-launch-type branch June 10, 2021 22:05
@github-actions
Copy link

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

ewbankkit added a commit that referenced this pull request Jun 11, 2021
@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 Jul 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. documentation Introduces or discusses updates to documentation. size/L 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
Development

Successfully merging this pull request may close these issues.

2 participants