Description
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 -v
Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/aws v3.34.0
+ provider registry.terraform.io/hashicorp/external v2.1.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.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.
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
resource "aws_cloudwatch_event_rule" "this_rule" {
event_bus_name = local.rule_name
name = "some-rule-name"
description = "Some description."
event_pattern = <<EOF
{
"detail-type": ["Build Started"],
"detail": {
"build": {
"branch": ["master"]
}
}
}
EOF
}
Debug Output
Panic Output
Error: error reading CloudWatch Events Rule (aws.partner/service.com/name/c66a61fa-b4e7-4a80-9b61-2141a9b8fdf1/buildkite-build-outside-office-hours): unexpected format for ID ("aws.partner/service.com/name/b66c92fa-b4e7-4a83-9b61-2141a9b8fdgh/some-rule-name"), expected <event-bus-name>/<rule-name> or <rule-name>
Expected Behavior
Expected is that the eventbridge rule is created, which it is. However, the final step of the function returns a check in the state if the rule is there. This check fails because of a formatting error check that fails incorrectly (format is correct). End state is that the resource is in AWS, is in state as well, but can't be used since refreshing state will cause it to error with the above error.
Actual Behavior
Resource is build, but fails when state is checked (either during the apply, or afterwards during a plan).
Steps to Reproduce
terraform apply
Really, thats all there should be to it.
Important Factoids
Already checked out the source of this issue. aws/internal/service/cloudwatchevents/id.go
has a function called RuleParseID
, which is called at the end of each creation of a Eventbridge rule. The rule parser ID uses a /
to split the string of the rule name and checks if either:
a. The rule contains no /
by doing len(parts) == 1
and checking if the one part is not empty
b. The rule contains exactly one /
by doing len(parts) == 2
and both parts are not empty.
A check should be added here, checking if the first part is the string e.g parts[0] == "aws.partner"
which is used in each eventbus partner string. If this is the case, multiple /
should be allowed in the rule id.
References
None