Skip to content

Conversation

@lgallard
Copy link
Owner

@lgallard lgallard commented Aug 8, 2025

Fixes issue where repository_arn output was returning the repository name instead of the actual ARN.

Changes

  • Add local.repository_arn using .arn attribute instead of .id
  • Update repository_arn output to reference local.repository_arn

Fixes #137

Generated with Claude Code

- Add local.repository_arn using .arn attribute instead of .id
- Update repository_arn output to reference local.repository_arn
- Fixes issue where repository_arn was returning repository name

Fixes #137

Co-authored-by: Luis M. Gallardo D. <[email protected]>
@lgallard
Copy link
Owner Author

lgallard commented Aug 8, 2025

Codebot hunt

@claude
Copy link
Contributor

claude bot commented Aug 8, 2025

Claude finished @lgallard's task —— View job


🕵️ Bug Hunt Analysis

Analysis Tasks

  • Read and analyze changes in outputs.tf
  • Read and analyze changes in repository.tf
  • Check for potential bugs or edge cases
  • Verify fix addresses the original issue correctly
  • Provide final assessment and recommendations

🐛 Bug Analysis Results

The Fix is CORRECT

The issue was that repository_arn output in outputs.tf:4 was incorrectly referencing local.repository_id (which returns the repository name) instead of the actual ARN.

Before: value = local.repository_id ❌ (returns name, not ARN)
After: value = local.repository_arn ✅ (returns actual ARN)

Changes Made:

  1. repository.tf:126 - Added missing local.repository_arn that properly references the .arn attribute
  2. outputs.tf:4 - Fixed output to use local.repository_arn instead of local.repository_id

No Bugs Found

The implementation follows the existing dual-resource pattern correctly:

  • Uses conditional logic based on var.prevent_destroy
  • Leverages one() function for safe extraction from lists
  • Follows same pattern as other local variables in the file
  • Maintains consistency with repository_id, repository_name, repository_url, and registry_id locals

Edge Cases Covered

  • Protected repositories (prevent_destroy = true) → Uses aws_ecr_repository.repo_protected[*].arn
  • Standard repositories (prevent_destroy = false) → Uses aws_ecr_repository.repo[*].arn
  • No repository createdone() function safely returns null for empty lists

Verification

✓ Fix addresses the original issue completely
✓ No breaking changes introduced
✓ Follows existing code patterns and conventions
✓ Proper null handling for edge cases
✓ Output description remains accurate ("ARN of the ECR repository")

🎯 Final Assessment: SAFE TO MERGE

This is a clean, straightforward bug fix with no issues identified. The change is minimal, follows existing patterns, and correctly resolves the reported problem where repository_arn was returning the repository name instead of the ARN.


@lgallard lgallard merged commit 6b9f0cc into master Aug 8, 2025
3 of 4 checks passed
@lgallard lgallard deleted the claude/issue-137-20250808-0806 branch August 8, 2025 08:38
@github-actions github-actions bot mentioned this pull request Aug 8, 2025
@github-actions github-actions bot mentioned this pull request Aug 21, 2025
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.

BUG: id != arn

2 participants