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

Add support for API Gateway as an EventBrigde target #19337

Merged
merged 11 commits into from
May 12, 2021

Conversation

rubenfonseca
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" 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 #16624

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAccAWSCloudWatchEventTarget_http"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventTarget_http -timeout 180m
=== RUN   TestAccAWSCloudWatchEventTarget_http
=== PAUSE TestAccAWSCloudWatchEventTarget_http
=== CONT  TestAccAWSCloudWatchEventTarget_http
--- PASS: TestAccAWSCloudWatchEventTarget_http (44.91s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	49.066s

@rubenfonseca rubenfonseca requested a review from a team as a code owner May 12, 2021 08:33
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/cloudwatchevents tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels May 12, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 12, 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 @rubenfonseca 👋

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

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label May 12, 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 🚀.

Commercial
% 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_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_inputTransformerJsonString
=== CONT  TestAccAWSCloudWatchEventTarget_batch
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== CONT  TestAccAWSCloudWatchEventTarget_full
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
=== CONT  TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
=== CONT  TestAccAWSCloudWatchEventTarget_disappears
=== CONT  TestAccAWSCloudWatchEventTarget_http
=== CONT  TestAccAWSCloudWatchEventTarget_EventBusName
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (18.97s)
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (19.97s)
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (21.23s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (23.95s)
--- PASS: TestAccAWSCloudWatchEventTarget_http (27.48s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (37.63s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (37.83s)
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (38.91s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (44.32s)
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (46.24s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (55.43s)
--- PASS: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (62.67s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (63.73s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (64.03s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (79.20s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	82.461s
GovCloud
% 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_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_inputTransformerJsonString
=== CONT  TestAccAWSCloudWatchEventTarget_GeneratedTargetId
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
=== CONT  TestAccAWSCloudWatchEventTarget_batch
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
=== CONT  TestAccAWSCloudWatchEventTarget_full
=== CONT  TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
=== CONT  TestAccAWSCloudWatchEventTarget_disappears
=== CONT  TestAccAWSCloudWatchEventTarget_http
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
=== CONT  TestAccAWSCloudWatchEventTarget_EventBusName
=== CONT  TestAccAWSCloudWatchEventTarget_http
    provider_test.go:1115: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        2021/05/12 10:21:28 [DEBUG] Using modified User-Agent: Terraform/0.12.30 HashiCorp-terraform-exec/0.13.3
        
        Error: Error creating API Gateway: BadRequestException: Endpoint Configuration type EDGE is not supported in this region: us-gov-west-1
        
          on terraform_plugin_test.tf line 25, in resource "aws_api_gateway_rest_api" "test":
          25: resource "aws_api_gateway_rest_api" "test" {
        
        
--- SKIP: TestAccAWSCloudWatchEventTarget_http (15.51s)
--- PASS: TestAccAWSCloudWatchEventTarget_disappears (22.77s)
--- PASS: TestAccAWSCloudWatchEventTarget_GeneratedTargetId (25.40s)
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (25.98s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (29.15s)
--- PASS: TestAccAWSCloudWatchEventTarget_inputTransformerJsonString (39.36s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (40.77s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (41.01s)
=== CONT  TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig
    provider_test.go:1115: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        2021/05/12 10:21:28 [DEBUG] Using modified User-Agent: Terraform/0.12.30 HashiCorp-terraform-exec/0.13.3
        
        Error: Creating CloudWatch Events Target failed: UnknownOperationException: Operation is disabled in this region.
        	status code: 400, request id: 78aaab31-c381-46d6-baec-85898092bfb1
        
          on terraform_plugin_test.tf line 54, in resource "aws_cloudwatch_event_target" "test":
          54: resource "aws_cloudwatch_event_target" "test" {
        
        
--- PASS: TestAccAWSCloudWatchEventTarget_EventBusName (45.35s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (48.63s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (53.12s)
--- SKIP: TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig (57.95s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (68.87s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (69.49s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (141.53s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	144.461s

@ewbankkit
Copy link
Contributor

@rubenfonseca Thanks for the contribution 👏.
In order to get this merged quickly I went ahead and addressed the linter errors and also modified the flatten and expand routines to match our conventions.
Other than that, everything was in great shape.

@rubenfonseca
Copy link
Contributor Author

Thank you so much for your help! It was my first time with this code based, and I've already learned a lot about the conventions. Thank you!

@ewbankkit ewbankkit merged commit c7e8bdc into hashicorp:main May 12, 2021
@github-actions github-actions bot added this to the v3.40.0 milestone May 12, 2021
@ghost
Copy link

ghost commented May 13, 2021

This has been released in version 3.40.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 for triage. Thanks!

@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 Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

Add API Gateway target support to aws_cloudwatch_event_target
2 participants