Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

IAM: Migrate instance profiles#13811

Merged
dfangl merged 2 commits into
iam/moto-migrationfrom
cris/unc-232
Feb 24, 2026
Merged

IAM: Migrate instance profiles#13811
dfangl merged 2 commits into
iam/moto-migrationfrom
cris/unc-232

Conversation

@pinzon

@pinzon pinzon commented Feb 20, 2026

Copy link
Copy Markdown
Member

Motivation

As per the internalization project. This PR migrates the operations related to InstanceProfiles.

Changes

  1. localstack-core/localstack/services/iam/models.py
  • Added InstanceProfile import from localstack.aws.api.iam
  • Added InstanceProfileEntity dataclass:
    @dataclasses.dataclass
    class InstanceProfileEntity:
    instance_profile: InstanceProfile
    role_name: str | None = None # Name of the attached role (max 1 role per profile)
  • Added INSTANCE_PROFILES storage to IamStore
  1. localstack-core/localstack/services/iam/provider.py
  • Added imports: CreateInstanceProfileResponse, GetInstanceProfileResponse, InstanceProfile,
    ListInstanceProfilesForRoleResponse, ListInstanceProfilesResponse, InstanceProfileEntity
  • Added _instance_profile_lock: threading.Lock for thread-safe operations
  • Added helper methods: _get_instance_profile_entity, _generate_instance_profile_id,
    _build_instance_profile_arn, _build_role_for_instance_profile
  • Implemented 10 instance profile operations:
    • CRUD: create_instance_profile, get_instance_profile, delete_instance_profile,
      list_instance_profiles
    • Role management: add_role_to_instance_profile, remove_role_from_instance_profile,
      list_instance_profiles_for_role
    • Tags: tag_instance_profile, untag_instance_profile, list_instance_profile_tags

Tests

All related test about IAM InstanceProfiles must pass.

Merge after #13801

@pinzon pinzon added semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Feb 20, 2026
@pinzon pinzon added this to the 4.14 milestone Feb 20, 2026
@pinzon pinzon marked this pull request as ready for review February 20, 2026 17:47
@pinzon pinzon requested a review from dfangl as a code owner February 20, 2026 17:47
@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   2m 58s ⏱️ - 2h 7m 1s
518 tests  - 5 104  454 ✅  - 4 706  47 💤  - 384  17 ❌  - 14 
520 runs   - 5 104  454 ✅  - 4 706  49 💤  - 384  17 ❌  - 14 

For more details on these failures, see this check.

Results for commit 5e99f87. ± Comparison against base commit 00594bb.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

Test Results - Preflight, Unit

23 123 tests  ±0   21 249 ✅  - 3   5m 45s ⏱️ -32s
     1 suites ±0    1 871 💤 ±0 
     1 files   ±0        3 ❌ +3 

For more details on these failures, see this check.

Results for commit 5e99f87. ± Comparison against base commit 00594bb.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   2m 57s ⏱️ +8s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 2619b48. ± Comparison against base commit 3e9b86f.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

Test Results (amd64) - Integration, Bootstrap

    5 files  ±0      5 suites  ±0   2h 50m 30s ⏱️ + 9m 26s
6 026 tests  - 1  5 373 ✅  - 42  573 💤  - 29  80 ❌ +70 
6 032 runs   - 1  5 373 ✅  - 42  579 💤  - 29  80 ❌ +70 

For more details on these failures, see this check.

Results for commit 2619b48. ± Comparison against base commit 3e9b86f.

♻️ This comment has been updated with latest results.

@dfangl dfangl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! I added the error if a role is deleted while an instance profile exists for it, the test was still skipped!

@dfangl dfangl merged commit c51a449 into iam/moto-migration Feb 24, 2026
5 of 7 checks passed
@dfangl dfangl deleted the cris/unc-232 branch February 24, 2026 18:38
dfangl added a commit that referenced this pull request Feb 26, 2026
Co-authored-by: Daniel Fangl <daniel.fangl@localstack.cloud>
dfangl added a commit that referenced this pull request Feb 26, 2026
Co-authored-by: Daniel Fangl <daniel.fangl@localstack.cloud>
dfangl added a commit that referenced this pull request Mar 4, 2026
Co-authored-by: Daniel Fangl <daniel.fangl@localstack.cloud>
dfangl added a commit that referenced this pull request Mar 6, 2026
Co-authored-by: Daniel Fangl <daniel.fangl@localstack.cloud>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants