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

New Resource: aws_cloudwatch_event_permission #2888

Merged
merged 2 commits into from
Jan 11, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 7, 2018

Closes #1042

Please note the implementation is a little awkward because there are PutPermission/RemovePermission API actions but reading is done via the backend created IAM policy on the event bus, available via the Policy attribute on DescribeEventBus. There's also a peculiarity with the PutPermission API concurrency where two "parallel" operations will only write the last received entry, but it always returns 200 OKs for both requests. If there's a good solution for a resource-wide mutex, this would be a good place for one.

References:

make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventPermission'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSCloudWatchEventPermission -timeout 120m
=== RUN   TestAccAWSCloudWatchEventPermission_Basic
--- PASS: TestAccAWSCloudWatchEventPermission_Basic (21.94s)
=== RUN   TestAccAWSCloudWatchEventPermission_Action
--- PASS: TestAccAWSCloudWatchEventPermission_Action (12.60s)
=== RUN   TestAccAWSCloudWatchEventPermission_Import
--- PASS: TestAccAWSCloudWatchEventPermission_Import (12.90s)
=== RUN   TestAccAWSCloudWatchEventPermission_Multiple
--- PASS: TestAccAWSCloudWatchEventPermission_Multiple (21.84s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	69.327s

@radeksimko radeksimko added the new-resource Introduces a new resource. label Jan 8, 2018
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM, just one nitpick.

policyStatement = &statement
return nil
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Certainly simplifies things! Hadn't run into resource.NotFoundError yet, looks super handy. I'll update this PR with a similar implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated and verified locally:

make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchEventPermission'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSCloudWatchEventPermission -timeout 120m
=== RUN   TestAccAWSCloudWatchEventPermission_Basic
--- PASS: TestAccAWSCloudWatchEventPermission_Basic (19.04s)
=== RUN   TestAccAWSCloudWatchEventPermission_Action
--- PASS: TestAccAWSCloudWatchEventPermission_Action (8.98s)
=== RUN   TestAccAWSCloudWatchEventPermission_Import
--- PASS: TestAccAWSCloudWatchEventPermission_Import (12.85s)
=== RUN   TestAccAWSCloudWatchEventPermission_Multiple
--- PASS: TestAccAWSCloudWatchEventPermission_Multiple (17.88s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	58.793s

* Add and utilize findCloudWatchEventPermissionPolicyStatementByID function in logic and testing
@bflad bflad merged commit 895919d into hashicorp:master Jan 11, 2018
@bflad bflad deleted the f-aws_cloudwatch_event_permission branch January 11, 2018 16:11
bflad added a commit that referenced this pull request Jan 11, 2018
@bflad
Copy link
Contributor Author

bflad commented Jan 12, 2018

This has been released in terraform-provider-aws version 1.7.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@bflad bflad modified the milestones: v1.7.1, v1.7.0 Jan 12, 2018
jocgir added a commit to coveooss/terraform-provider-aws that referenced this pull request Jan 12, 2018
* commit 'b9284490eff637460fef663794a496d363e19f10': (190 commits)
  v1.7.0
  Update CHANGELOG.md
  d/aws_ssm_parameter: Support returning raw encrypted SecureString value. (hashicorp#2777)
  Bump aws-sdk-go to v1.12.60
  Update CHANGELOG.md
  Add acceptance test for import + randomization
  Removed reference to Core fixes
  Add instructions for vendor updates
  Use AWS example instead of Azure
  Update CHANGELOG for hashicorp#2833
  Update CHANGELOG.md
  r/lb_target_group: Fix validation rules for LB's healthcheck
  Update CHANGELOG for hashicorp#2911
  r/aws_guardduty_member: Provide given ID in error message when incorrect format
  Update CHANGELOG.md
  Update CHANGELOG with hashicorp#2888
  r/aws_guardduty_member: hashicorp#2911 PR review
  r/aws_cloudwatch_event_permission: hashicorp#2888 PR review
  Makefile: Fixed test outputs
  resource/aws_lb+aws_elb: Fix regression with undefined 'name'
  ...

# Conflicts:
#	.gitignore
#	aws/data_source_aws_s3_bucket_object.go
#	aws/resource_aws_elasticsearch_domain.go
@ghost
Copy link

ghost commented Apr 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CloudWatch Events EventBuses
2 participants