You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CreateOrGetInstanceProfile does not re-add the role to an existing empty instance profile #1318
Found while implementing #1300 (reaping unused per-task spawn-instance-* roles).
pkg/aws.CreateOrGetInstanceProfile (pkg/aws/iam.go) calls AddRoleToInstanceProfile only inside if !profileExists { ... }. When the profile already exists it is returned as-is, without checking that GetInstanceProfile().InstanceProfile.Roles contains the role.
So a profile that exists with no role attached is handed to RunInstances and the instance boots with no credentials: spored cannot read its own tags, flush its task or terminate itself (the reaper's TTL backstop still applies).
Any earlier partial failure of pkg/aws.deleteInstanceProfile/deleteRole (cleanup), which ignore errors between steps.
Proposed fix: in the profileExists branch, read the profile's Roles; if the role is absent, AddRoleToInstanceProfile (LimitExceeded = another role already attached → error naming it) and waitForInstanceProfile. Also consider handling NoSuchEntity from GetInstanceProfile right after the existence check (profile deleted mid-launch) by retrying the create path once.
Evidence: code reading only (no AWS run); see the if !profileExists { block in CreateOrGetInstanceProfile.
Activity
feat(reaper): delete unused per-task spawn-instance-* IAM roles and p…
feat(reaper): delete unused per-task spawn-instance-* IAM roles and p…
feat(reaper): delete unused per-task spawn-instance-* IAM roles and p…