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

[Bug]: can't create multiple cloudwatch_event_target with same rule and arn #39233

Open
livgust opened this issue Sep 9, 2024 · 1 comment
Open
Labels
bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/events Issues and PRs that pertain to the events service.

Comments

@livgust
Copy link

livgust commented Sep 9, 2024

Terraform Core Version

1.4.2

AWS Provider Version

4.67.0

Affected Resource(s)

  • aws_cloudwatch_event_target

Expected Behavior

For a single event with two associated targets, both targets should be created.

Actual Behavior

If the two targets with the same event have the same rule and arn, only one is created. Even if, as in my case, the inputs are different.

I was able to rectify the issue by adding target_id to both targets with different unique values. Only then were both targets created as expected.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Please see reproduction code below. No error was output.

Steps to Reproduce

resource "aws_cloudwatch_event_rule" "every_morning" {
  name                = "${var.name}-every-morning-${var.env}"
  description         = "Fires every morning"
  schedule_expression = "cron(0 14 * * ? *)"
}

resource "aws_cloudwatch_event_target" "run_jobs_every_morning" {
  # target_id = "dailyNotifications"
  rule      = aws_cloudwatch_event_rule.every_morning.name
  arn       = aws_lambda_function.notification_jobs_lambda.arn
  input     = "{\"jobName\": \"dailyNotifications\"}"
}

resource "aws_cloudwatch_event_target" "run_integrations_every_morning" {
  # target_id = "dailyIntegrations"
  rule      = aws_cloudwatch_event_rule.every_morning.name
  arn       = aws_lambda_function.notification_jobs_lambda.arn
  input     = "{\"jobName\": \"dailyIntegrations\"}"
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@livgust livgust added the bug Addresses a defect in current functionality. label Sep 9, 2024
Copy link

github-actions bot commented Sep 9, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/events Issues and PRs that pertain to the events service. needs-triage Waiting for first response or review from a maintainer. labels Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/events Issues and PRs that pertain to the events service.
Projects
None yet
Development

No branches or pull requests

1 participant