Skip to content

Add support for ResourcePolicy CRD - #76

Merged
ack-prow[bot] merged 15 commits into
aws-controllers-k8s:mainfrom
knottnt:resource-policy
Aug 31, 2026
Merged

ack-prow[bot] merged 15 commits into
aws-controllers-k8s:mainfrom
knottnt:resource-policy

Conversation

@knottnt

@knottnt knottnt commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:
Based off of #71 by @mahasiva-amazon with some additional fixes to prevent regressions in the LogGroup resource and leverage generated code in the update operation.

  • Explicitly declares DescribeLogGroups as the ReadMany operation for the LogGroup resource
  • Add unrelated LogGroup fields to the ignored field paths
  • Use post_build_request template instead of fully custom update operation to set ExpectedRevisionID
  • Remove leftover artifacts from ImportTask and ScheduledQuery ignored resources.
  • Adds test case for ResourceARN based ResourcePolicy

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

mahasiva-amazon and others added 7 commits July 29, 2026 15:02
- Add ResourcePolicy resource using PutResourcePolicy as Create operation
- Use aws_service_sdk_version v1.65.0 which includes ResourceArn, RevisionId,
  PolicyScope, ExpectedRevisionId fields — no hook templates needed
- Use is_iam_policy: true for PolicyDocument to support IAM semantic comparison
  (handles statement reordering, Action arrays vs strings, Principal variations)
- Add custom update handler (customUpdateResourcePolicy) for ExpectedRevisionId
  on resource-scoped policies to prevent concurrent modification errors
- Ignore ImportTask and ScheduledQuery resources added in v1.65.0 SDK
- Add unit tests for IAMPolicyDocumentEqual delta behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate sdkUpdate implemenation with template hook for populating ExpectedRevisionID
@ack-prow ack-prow Bot added the approved label Aug 18, 2026
- When ResourceARN is set ensure that Resource policy scope is applied
- Set ExpectedRevisionId when deleting resource scoped policies
- Add hooks for create/update to use top level RevisionID when setting Status.RevisionID

- Re-generate with forked code-generator
Comment thread generator.yaml Outdated
# ResourceARN. PolicyName is designated the primary key so identifier code
# still generates, and is_primary_key_optional makes adoption populate
# whichever identifier fields the user supplies without requiring PolicyName.
is_primary_key_optional: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Add custom_check_required_fields_missing_method to fail sdkFind with NotFound if neither identifier is set.
- Add e2e tests to validate missing adoption-fields scenario and validate positive cases for policyName and resourceARN
@knottnt knottnt added the release/minor Indicates this PR should trigger a minor version release on merge. label Aug 21, 2026
- Apply mutually_exclusive_identifiers config for PolicyName and ResourceArn
- Add tests for PopulateResourceFromAnnotation and requiredFieldsMissingFromReadManyInput
@gustavodiaz7722

Copy link
Copy Markdown
Member

/LGTM

@ack-prow ack-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 31, 2026
@ack-prow

ack-prow Bot commented Aug 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gustavodiaz7722, knottnt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [gustavodiaz7722,knottnt]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow
ack-prow Bot merged commit 4859942 into aws-controllers-k8s:main Aug 31, 2026
9 checks passed
ack-prow Bot pushed a commit that referenced this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm Indicates that a PR is ready to be merged. release/minor Indicates this PR should trigger a minor version release on merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants