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

aws_cloudwatch_event_rule creates rules in other accounts but fails to read them with error unexpected format for ID #19234

Closed
masaka3620 opened this issue May 4, 2021 · 5 comments · Fixed by #20613
Labels
bug Addresses a defect in current functionality.
Milestone

Comments

@masaka3620
Copy link

masaka3620 commented May 4, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/aws v3.37.0

Affected Resource(s)

  • aws_cloudwatch_event_rule

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_cloudwatch_event_permission" "allow_event_forwarder" {
  principal    = "999999999999"
  statement_id = "allow-event-forwarder"
}

resource "aws_cloudwatch_event_rule" "event-forwarder" {
  name           = "event-forwarder"
  description    = "Forwards events from the source event bus to the default bus in the my account"

  event_bus_name = "arn:aws:events:my-region:999999999999:event-bus/source-event-bus" 

  event_pattern = <some pattern>
}

The rule is created and the provider exits successfully

Actual Behavior

The rule was created successfully, however terraform exited with failure. The failure message, which also happens on subsequent runs of terraform was:

Error: error reading CloudWatch Events Rule (arn:arn:aws:events:my-region:999999999999:event-bus/my-rule-in-another-account): unexpected format for ID ("arn:aws:events:my-region:999999999999:event-bus/source-event-bus/event-forwarder"), expected <event-bus-name>/<rule-name> or <rule-name>

Steps to Reproduce

  1. terraform apply

Important Factoids

We were following these guidelines: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cross-account.html

In our case, we have an AWS organization. For simplicity, we'll say we have accounts A & B. Account A has an event bus that is receiving certain events. There are IAM permissions that allow anyone in the organization to create rules against that event bus without having to assume a role in that account directly.

References

In searching around for solution to this, I found #16982, which would have solved my problem, but it appears to have been closed by the contributor. #19072 was promising, but seemed specific to partner buses, which isn't my use case.

@ghost ghost added service/cloudwatchevents service/cloudwatch Issues and PRs that pertain to the cloudwatch service. labels May 4, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 4, 2021
@ewbankkit
Copy link
Contributor

@0nedark
Copy link

0nedark commented May 16, 2021

I'm experiencing the same issue even when creating rules in the same account

Terraform v0.15.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.40.0

@FrancescoFucile-CAZ
Copy link
Contributor

This PR should fix the issue.
#20312

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed service/cloudwatch Issues and PRs that pertain to the cloudwatch service. needs-triage Waiting for first response or review from a maintainer. labels Aug 18, 2021
@github-actions github-actions bot added this to the v3.55.0 milestone Aug 18, 2021
@github-actions
Copy link

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

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 have found a problem that seems similar to this, 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 Sep 19, 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.
Projects
None yet
4 participants