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]: aws_cloudwatch_event_rule update does not propagate tags #39646

Closed
pedrokiefer opened this issue Oct 9, 2024 · 4 comments · Fixed by #39648
Closed

[Bug]: aws_cloudwatch_event_rule update does not propagate tags #39646

pedrokiefer opened this issue Oct 9, 2024 · 4 comments · Fixed by #39648
Labels
bug Addresses a defect in current functionality. service/events Issues and PRs that pertain to the events service.
Milestone

Comments

@pedrokiefer
Copy link
Contributor

pedrokiefer commented Oct 9, 2024

Terraform Core Version

1.3.5,1.9.7

AWS Provider Version

5.32.1,5.70.0

Affected Resource(s)

  • aws_cloudwatch_event_rule - update

Expected Behavior

We use ABAC to managed who can create / update Event Rules, this works by using RequestTag on SCP rule. When using terraform to update an event rule those tags are not sent and we get an explicit deny from AWS.

We expect the tags to be sent along.

On creation we have the following code:

	name := create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string))
	input := expandPutRuleInput(d, name)
	input.Tags = getTagsIn(ctx)

	arn, err := retryPutRule(ctx, conn, input)

https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/events/rule.go#L156

But on update the input.Tags does not get populated:

		input := expandPutRuleInput(d, ruleName)

		_, err = retryPutRule(ctx, conn, input)

		if err != nil {
			return sdkdiag.AppendErrorf(diags, "updating EventBridge Rule (%s): %s", d.Id(), err)
		}

https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/events/rule.go#L260

Actual Behavior

│ Error: updating EventBridge Rule (searches-update-scheduler-rule): AccessDeniedException: User: arn:aws:sts::XXXX:assumed-role/AWSReservedSSO_profile_1234/name.lastname@redacted.com is not authorized to perform: events:PutRule on resource: arn:aws:events:us-east-1:XXXX:rule/recommendation-related-searches-update-scheduler-rule with an explicit deny in an identity-based policy
│       status code: 400, request id: cfe6d7ef-00dd-1234-a574-27f20cb70779

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

  source  = "terraform-aws-modules/eventbridge/aws"
  version = "1.17.0"

  create_bus = false
  create_role = false

  rules = {
    "${local.prefix}-scheduler" = {
      schedule_expression = "cron(0 0 ? * SUN *)" # every week at midnight on sunday
      enabled = true
    }
  }

  targets = {
    "${local.prefix}-scheduler" = [
      {
        name = "${local.prefix}-scheduler"
        arn = aws_batch_job_queue.job_queue.arn
        attach_role_arn = var.event_role
        batch_target = {
          job_definition = aws_batch_job_definition.job_definition.arn
          job_name = "${local.prefix}-job"
          job_attempts = 3
        }
      }
    ]
  }

  tags={
      some=1
      tags=2
      here=3
      required-abac-tag = my-team-value
  }
}

Steps to Reproduce

Try to change the schedule_expression and update the resource.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

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

github-actions bot commented Oct 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 Oct 9, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Oct 11, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.72.0 milestone Oct 15, 2024
Copy link

This functionality has been released in v5.72.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!

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 Nov 15, 2024
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. service/events Issues and PRs that pertain to the events service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants