Skip to content

docs/cloudwatch_event_target: reference the rule name, not its id - #49887

Open
dchaudhari7177 wants to merge 1 commit into
hashicorp:mainfrom
dchaudhari7177:docs-cwet-rule-name
Open

docs/cloudwatch_event_target: reference the rule name, not its id#49887
dchaudhari7177 wants to merge 1 commit into
hashicorp:mainfrom
dchaudhari7177:docs-cwet-rule-name

Conversation

@dchaudhari7177

Copy link
Copy Markdown

Description

Four examples on the aws_cloudwatch_event_target page set rule from aws_cloudwatch_event_rule.<name>.id. The argument reference on the same page says rule is "The name of the rule you want to add targets to", and the remaining examples on the page already use .name.

.id happens to equal the name only on the default event bus. From internal/service/events/rule.go:

func ruleCreateResourceID(eventBusName, ruleName string) string {
	if eventBusName == "" || eventBusName == defaultEventBusName {
		return ruleName
	}
	parts := []string{eventBusName, ruleName}
	return strings.Join(parts, ruleResourceIDSeparator)   // "<event_bus_name>/<rule_name>"
}

So a reader who copies one of these examples and points it at a custom event bus gets my-bus/my-rule where a bare rule name is required. This makes the four examples consistent with the page's own argument reference and with its other examples.

Relations

Closes #49798

Changes

Only website/docs/r/cloudwatch_event_target.html.markdown, four lines, .id.name:

line example
248 API Gateway target
334 Input Transformer Usage - JSON Object
360 Input Transformer Usage - Simple String
468 AppSync Usage

No configuration or generated code is touched, so there is no .changelog entry.

Output from Acceptance Testing

Website-only change; no acceptance tests apply.

`rule` takes the rule's name. `aws_cloudwatch_event_rule`'s id is only
the name on the default event bus; ruleCreateResourceID joins
`<event_bus_name>/<rule_name>` for any other bus, so these four examples
break as soon as they are adapted to a custom bus. The other examples in
this page already use `.name`.
@dchaudhari7177
dchaudhari7177 requested a review from a team as a code owner September 8, 2026 06:39
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/events Issues and PRs that pertain to the events service. size/XS Managed by automation to categorize the size of a PR. labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Introduces or discusses updates to documentation. needs-triage Waiting for first response or review from a maintainer. service/events Issues and PRs that pertain to the events service. size/XS Managed by automation to categorize the size of a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws_cloudwatch_event_target has incorrect examples.

1 participant