-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 Cloudwatch Event API Destination and Connections #18905
Add support for Cloudwatch Event API Destination and Connections #18905
Conversation
Currently working on the tests working, would someone be able to check over the schema structure for the Connection as its pretty nested 🙏 |
@jordanfinners I skimmed over the schema and didn't see anything glaringly wrong. It is quite nested but you seem to be managing it well. If at all possible, we do like the arguments to be in alphabetical order. With so many people adding so many things, keeping them in order helps. I would also highly recommend looking at https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/data-handling-and-conversion.md for information on current best practices. Unfortunately, we have a lot of places in the codebase with deprecated styles and ways of doing things. If you're following those places, it does make review harder. Another good one that's up to date is here: https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/retries-and-waiters.md. Best regards, and best of luck! |
Thanks @YakDriver ! |
@YakDriver ready for review! 👍 |
Hey @YakDriver, @ewbankkit @bflad would you mind reviewing this again please 🙏 Would be great to get it merged 😃 |
Hey @heitorlessa did you have chance to review this please 🙏 |
Destination resource LGTM. I need some more time to digest the Connection resource where I can spend 30 min uninterruptedly to double check some Hashicorp common practices on flattening |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good except two things:
-
secret_arn
attribute not being set. When parameter values are set to be secret EventBridge return a Secret ARN that it stored in Secrets Manager so one could fetch it. -
Data source for
event_connection
since that can be used by one or more API Destinations. This will help customers using TF Modules or retrieving an existing connection instead of hardcoding its ARN.
Once these are done, I'll pass this in for priorisation and merge :)
Thanks a lot for doing this, it looks great!
One secret_arn per connection for an arbitrary number of params with a
secret value.
…On Fri, 21 May 2021 at 11:00, Jordan Finneran ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In aws/resource_aws_cloudwatch_event_connection.go
<#18905 (comment)>
:
> + },
+ },
+ },
+ },
+ },
+ },
+ "invocation_http_parameters": {
+ Type: schema.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: connectionHttpParameters,
+ },
+ },
+ },
+ },
+ "arn": {
Will you only get one secret_arn back or will it be one per param?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18905 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBDWCWMPNN4YS73IICTTOYOKNANCNFSM4277CUUQ>
.
|
I've added these now! :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these changes - LGTM ;)
Not sure what github did, was re-requesting review from julesjcraske and it removed |
There was a problem hiding this 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=TestAccAWSCloudWatchEventConnection_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventConnection_ -timeout 180m
=== RUN TestAccAWSCloudWatchEventConnection_apiKey
=== PAUSE TestAccAWSCloudWatchEventConnection_apiKey
=== RUN TestAccAWSCloudWatchEventConnection_basic
=== PAUSE TestAccAWSCloudWatchEventConnection_basic
=== RUN TestAccAWSCloudWatchEventConnection_oAuth
=== PAUSE TestAccAWSCloudWatchEventConnection_oAuth
=== RUN TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== PAUSE TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== RUN TestAccAWSCloudWatchEventConnection_disappears
=== PAUSE TestAccAWSCloudWatchEventConnection_disappears
=== CONT TestAccAWSCloudWatchEventConnection_apiKey
=== CONT TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== CONT TestAccAWSCloudWatchEventConnection_disappears
=== CONT TestAccAWSCloudWatchEventConnection_oAuth
=== CONT TestAccAWSCloudWatchEventConnection_basic
--- PASS: TestAccAWSCloudWatchEventConnection_disappears (34.57s)
--- PASS: TestAccAWSCloudWatchEventConnection_basic (116.08s)
--- PASS: TestAccAWSCloudWatchEventConnection_invocationHttpParameters (116.51s)
--- PASS: TestAccAWSCloudWatchEventConnection_oAuth (125.83s)
--- PASS: TestAccAWSCloudWatchEventConnection_apiKey (167.92s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 171.076s
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventApiDestination_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventApiDestination_ -timeout 180m
=== RUN TestAccAWSCloudWatchEventApiDestination_basic
=== PAUSE TestAccAWSCloudWatchEventApiDestination_basic
=== RUN TestAccAWSCloudWatchEventApiDestination_optional
=== PAUSE TestAccAWSCloudWatchEventApiDestination_optional
=== RUN TestAccAWSCloudWatchEventApiDestination_disappears
=== PAUSE TestAccAWSCloudWatchEventApiDestination_disappears
=== CONT TestAccAWSCloudWatchEventApiDestination_basic
=== CONT TestAccAWSCloudWatchEventApiDestination_disappears
=== CONT TestAccAWSCloudWatchEventApiDestination_optional
--- PASS: TestAccAWSCloudWatchEventApiDestination_disappears (14.43s)
--- PASS: TestAccAWSCloudWatchEventApiDestination_optional (36.85s)
--- PASS: TestAccAWSCloudWatchEventApiDestination_basic (37.66s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 40.878s
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSDataSourceCloudwatch_Event_Connection_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSDataSourceCloudwatch_Event_Connection_ -timeout 180m
=== RUN TestAccAWSDataSourceCloudwatch_Event_Connection_basic
=== PAUSE TestAccAWSDataSourceCloudwatch_Event_Connection_basic
=== CONT TestAccAWSDataSourceCloudwatch_Event_Connection_basic
--- PASS: TestAccAWSDataSourceCloudwatch_Event_Connection_basic (75.98s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 79.013s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventConnection_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventConnection_ -timeout 180m
=== RUN TestAccAWSCloudWatchEventConnection_apiKey
=== PAUSE TestAccAWSCloudWatchEventConnection_apiKey
=== RUN TestAccAWSCloudWatchEventConnection_basic
=== PAUSE TestAccAWSCloudWatchEventConnection_basic
=== RUN TestAccAWSCloudWatchEventConnection_oAuth
=== PAUSE TestAccAWSCloudWatchEventConnection_oAuth
=== RUN TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== PAUSE TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== RUN TestAccAWSCloudWatchEventConnection_disappears
=== PAUSE TestAccAWSCloudWatchEventConnection_disappears
=== CONT TestAccAWSCloudWatchEventConnection_apiKey
=== CONT TestAccAWSCloudWatchEventConnection_invocationHttpParameters
=== CONT TestAccAWSCloudWatchEventConnection_oAuth
=== CONT TestAccAWSCloudWatchEventConnection_disappears
=== CONT TestAccAWSCloudWatchEventConnection_basic
=== CONT TestAccAWSCloudWatchEventConnection_disappears
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:48:42 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-4305597680382262485) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: d0907a45-332c-49ac-b3fe-fbc755b4795f
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "api_key":
2: resource "aws_cloudwatch_event_connection" "api_key" {
=== CONT TestAccAWSCloudWatchEventConnection_basic
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:48:42 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-9201948011675794539) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: f0cab8e7-efef-4da5-9d3e-0af624277624
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "basic":
2: resource "aws_cloudwatch_event_connection" "basic" {
=== CONT TestAccAWSCloudWatchEventConnection_oAuth
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:48:42 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-5998789718151218737) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: 60897055-390a-4c23-a8ef-da18e0a5fa3f
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "oauth":
2: resource "aws_cloudwatch_event_connection" "oauth" {
=== CONT TestAccAWSCloudWatchEventConnection_invocationHttpParameters
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:48:42 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-5357976610980534660) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: 5b69a983-0b51-4846-b044-298a6d7ccc2f
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "invocation_http_parameters":
2: resource "aws_cloudwatch_event_connection" "invocation_http_parameters" {
=== CONT TestAccAWSCloudWatchEventConnection_apiKey
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:48:42 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-1206077227320570848) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: 7c7b1d04-a636-4383-83a4-8c5184bbd379
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "api_key":
2: resource "aws_cloudwatch_event_connection" "api_key" {
--- SKIP: TestAccAWSCloudWatchEventConnection_disappears (6.77s)
--- SKIP: TestAccAWSCloudWatchEventConnection_basic (6.77s)
--- SKIP: TestAccAWSCloudWatchEventConnection_oAuth (6.79s)
--- SKIP: TestAccAWSCloudWatchEventConnection_apiKey (6.82s)
--- SKIP: TestAccAWSCloudWatchEventConnection_invocationHttpParameters (6.82s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 9.961s
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventApiDestination_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudWatchEventApiDestination_ -timeout 180m
=== RUN TestAccAWSCloudWatchEventApiDestination_basic
=== PAUSE TestAccAWSCloudWatchEventApiDestination_basic
=== RUN TestAccAWSCloudWatchEventApiDestination_optional
=== PAUSE TestAccAWSCloudWatchEventApiDestination_optional
=== RUN TestAccAWSCloudWatchEventApiDestination_disappears
=== PAUSE TestAccAWSCloudWatchEventApiDestination_disappears
=== CONT TestAccAWSCloudWatchEventApiDestination_basic
=== CONT TestAccAWSCloudWatchEventApiDestination_disappears
=== CONT TestAccAWSCloudWatchEventApiDestination_optional
=== CONT TestAccAWSCloudWatchEventApiDestination_disappears
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:54:49 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-5609326720649779595) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: efdfbc38-8c65-4a45-ad08-328027f3c09f
on terraform_plugin_test.tf line 9, in resource "aws_cloudwatch_event_connection" "test":
9: resource "aws_cloudwatch_event_connection" "test" {
=== CONT TestAccAWSCloudWatchEventApiDestination_basic
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:54:49 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-2705877033536899691) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: d1efbc3d-1aac-4b33-b63f-4c5bebd651e2
on terraform_plugin_test.tf line 9, in resource "aws_cloudwatch_event_connection" "test":
9: resource "aws_cloudwatch_event_connection" "test" {
=== CONT TestAccAWSCloudWatchEventApiDestination_optional
provider_test.go:1103: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:54:49 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-4958863464540868710) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: 3f14ebad-dce3-46be-b1a0-07e37eb8ec04
on terraform_plugin_test.tf line 12, in resource "aws_cloudwatch_event_connection" "test":
12: resource "aws_cloudwatch_event_connection" "test" {
--- SKIP: TestAccAWSCloudWatchEventApiDestination_disappears (5.88s)
--- SKIP: TestAccAWSCloudWatchEventApiDestination_basic (5.88s)
--- SKIP: TestAccAWSCloudWatchEventApiDestination_optional (5.89s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 9.461s
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSDataSourceCloudwatch_Event_Connection_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSDataSourceCloudwatch_Event_Connection_ -timeout 180m
=== RUN TestAccAWSDataSourceCloudwatch_Event_Connection_basic
=== PAUSE TestAccAWSDataSourceCloudwatch_Event_Connection_basic
=== CONT TestAccAWSDataSourceCloudwatch_Event_Connection_basic
provider_test.go:1146: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
2021/05/24 13:59:08 [DEBUG] Using modified User-Agent: Terraform/0.12.31 HashiCorp-terraform-exec/0.13.3
Error: Creating CloudWatchEvent connection (tf-acc-test-3577340883533182219) failed: UnknownOperationException: Operation is disabled in this region.
status code: 400, request id: f1668189-877c-400e-a2e5-c140fd6c5b52
on terraform_plugin_test.tf line 2, in resource "aws_cloudwatch_event_connection" "api_key":
2: resource "aws_cloudwatch_event_connection" "api_key" {
--- SKIP: TestAccAWSDataSourceCloudwatch_Event_Connection_basic (6.56s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 9.614s
@jordanfinners Thanks for the contribution 👏 🎉. Whilst running the acceptance tests I hit:
in |
This has been released in version 3.43.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! |
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. |
Add support for Cloudwatch Event API Destination and Connections (aka Eventbridge API Destination and Connections)
Community Note
Closes #17950
Output from acceptance testing:
Connection:
API Destination:
Tests for the additional data source