Skip to content

fix(assume-role): resolve the IAM provider by category instead of specification slug - #50

Open
agustincelentano wants to merge 2 commits into
mainfrom
fix/iam-provider-lookup
Open

fix(assume-role): resolve the IAM provider by category instead of specification slug#50
agustincelentano wants to merge 2 commits into
mainfrom
fix/iam-provider-lookup

Conversation

@agustincelentano

@agustincelentano agustincelentano commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

provider_arn_for_selector runs np provider list --nrn <account> --specification_slug aws-iam-configuration and takes the first result. The API ignores --specification_slug and returns every provider registered under the nrn (13 in our account, the IAM one in position 6), so the lookup returns an unrelated provider, the selector never matches and ASSUME_ROLE_ARN stays empty. Workflows then run with the pod's IRSA identity and fail on the first call that needs the scope role (for us: route53:GetHostedZone in setup_dns).

Reproduced with np CLI 2.8.0 (worker image) and 2.10.0 (agent pod).

Fix

Filter with --categories identity-access-control, which the API honors and returns exactly the IAM provider. Test stubs updated to the new flag; the 17 bats cases in assume_role_lib.bats pass.

Also: delete-scope leaves the function role behind

aws_iam_role.lambda fails to destroy with AccessDenied: iam:ListInstanceProfilesForRole: the AWS provider lists a role's instance profiles before deleting it and the requirements policy does not grant that action. The scope ends in failed with the role left in the account. Second commit adds the action to the requirements policy.

…cification slug

np provider list ignores --specification_slug and returns every provider
under the nrn, so the lookup took whichever provider came first and the
role never resolved. Filter by the identity-access-control category, which
the API honors.
…ope can remove the role

The AWS provider lists a role's instance profiles before deleting it; without
this action every tofu destroy fails on aws_iam_role.lambda and the scope is
left in failed with the role behind.
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