From 8207ddf9cf92cfa6c12b382bdb2291d2670b9d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Farias?= Date: Wed, 8 Jan 2025 13:59:47 +0100 Subject: [PATCH] Update aws iam role mapping --- internal/inventory/awsfetcher/fetcher_iam_role.go | 4 ++++ internal/inventory/awsfetcher/fetcher_iam_role_test.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/internal/inventory/awsfetcher/fetcher_iam_role.go b/internal/inventory/awsfetcher/fetcher_iam_role.go index 4f22d88f5d..d3c57b393d 100644 --- a/internal/inventory/awsfetcher/fetcher_iam_role.go +++ b/internal/inventory/awsfetcher/fetcher_iam_role.go @@ -79,6 +79,10 @@ func (i *iamRoleFetcher) Fetch(ctx context.Context, assetChannel chan<- inventor AccountName: i.AccountName, ServiceName: "AWS IAM", }), + inventory.WithUser(inventory.User{ + ID: pointers.Deref(role.Arn), + Name: pointers.Deref(role.RoleName), + }), ) } } diff --git a/internal/inventory/awsfetcher/fetcher_iam_role_test.go b/internal/inventory/awsfetcher/fetcher_iam_role_test.go index cb0cc35592..585827edcc 100644 --- a/internal/inventory/awsfetcher/fetcher_iam_role_test.go +++ b/internal/inventory/awsfetcher/fetcher_iam_role_test.go @@ -82,6 +82,10 @@ func TestIAMRoleFetcher_Fetch(t *testing.T) { AccountName: "alias", ServiceName: "AWS IAM", }), + inventory.WithUser(inventory.User{ + ID: "arn:aws:iam::0000:role/role-name-1", + Name: "role-name-1", + }), ), inventory.NewAssetEvent( @@ -96,6 +100,10 @@ func TestIAMRoleFetcher_Fetch(t *testing.T) { AccountName: "alias", ServiceName: "AWS IAM", }), + inventory.WithUser(inventory.User{ + ID: "arn:aws:iam::0000:role/role-name-2", + Name: "role-name-2", + }), ), }