Skip to content

fix(ecr): remove read section, cross-account role, and fix setup.policy drift#389

Merged
sebastiancorrea81 merged 2 commits into
mainfrom
fix/ecr-remove-read-use-policy-empty-string
Jun 10, 2026
Merged

fix(ecr): remove read section, cross-account role, and fix setup.policy drift#389
sebastiancorrea81 merged 2 commits into
mainfrom
fix/ecr-remove-read-use-policy-empty-string

Conversation

@sebastiancorrea81

Copy link
Copy Markdown
Collaborator

Summary

  • nullplatform/asset/ecr: Removes the deprecated read block and cross_account_pull_role_arn variable from the ECR provider config. The read section was used by a legacy installation pattern (role assumption-based cross-account pull) that is no longer used for new installations. Also simplifies setup.policy handling — always includes the field using var.repository_policy directly (empty string when not set), which the nullplatform API preserves as-is, avoiding perpetual drift on enable/disable cycles.
  • infrastructure/aws/iam/ecr: Removes the ecr_cross_account_pull IAM role, policy, and attachment. This role was exclusively used to populate read.role_arn in the provider config, which is now removed. Cross-account pull access is now handled entirely via ECR repository policy (setup.policy). Removes the cross_account_pull_role_arn output accordingly.

Context

The root cause of the drift was PATCH merge semantics in the nullplatform API: keys absent from the PATCH body are preserved rather than cleared. This made it impossible to remove the read section once set without sending an explicit removal signal. Since read.role_arn rejects empty strings and nulls at the API level (unlike setup.policy which accepts ""), the cleanest fix is to remove read from the module entirely.

Test plan

  • tofu validate passes
  • Fresh apply (no prior state) → No changes on subsequent plan
  • Enable cross-account pull → apply → No changes on subsequent plan (no IAM role created, only setup.policy updated)
  • Disable cross-account pull → apply → No changes on subsequent plan (setup.policy cleared correctly)

🤖 Generated with Claude Code

sebas_correa and others added 2 commits June 10, 2026 16:33
- Remove cross_account_pull_role_arn variable and read block from provider
  config — the read section is deprecated for new installations and caused
  perpetual drift due to PATCH merge semantics (absent keys are preserved
  by the API rather than cleared)
- Always include setup.policy using var.repository_policy directly instead
  of a conditional merge — the nullplatform API preserves empty strings as-is,
  avoiding drift when cross-account pull is disabled
- Refactor attributes into a local for readability

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ecr_cross_account_pull role was used exclusively to populate
read.role_arn in the nullplatform provider config, which is a deprecated
installation pattern. Cross-account pull is now handled entirely via
ECR repository policy (setup.policy), making this role orphaned.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sebastiancorrea81 sebastiancorrea81 force-pushed the fix/ecr-remove-read-use-policy-empty-string branch from 7355843 to d1b1f56 Compare June 10, 2026 19:33
@sebastiancorrea81 sebastiancorrea81 merged commit 8000c6b into main Jun 10, 2026
44 checks passed
@sebastiancorrea81 sebastiancorrea81 deleted the fix/ecr-remove-read-use-policy-empty-string branch June 10, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants