Skip to content

Commit

Permalink
🐛 fix aws iam {attachedRoles {*}} query (#3596)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey authored Mar 19, 2024
1 parent 7938d30 commit 357389a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions providers/aws/resources/aws_iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,12 +1229,23 @@ func initAwsIamRole(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[
}

role := resp.Role

var policyDocumentMap map[string]interface{}
if role != nil && role.AssumeRolePolicyDocument != nil {
policyDocument := *role.AssumeRolePolicyDocument
decodedPolicyDocument, decodeErr := url.QueryUnescape(policyDocument)
if decodeErr == nil {
json.Unmarshal([]byte(decodedPolicyDocument), &policyDocumentMap)
}
}

args["arn"] = llx.StringDataPtr(role.Arn)
args["id"] = llx.StringDataPtr(role.RoleId)
args["name"] = llx.StringDataPtr(role.RoleName)
args["description"] = llx.StringDataPtr(role.Description)
args["tags"] = llx.MapData(iamTagsToMap(role.Tags), types.String)
args["createDate"] = llx.TimeDataPtr(role.CreateDate)
args["assumeRolePolicyDocument"] = llx.MapData(policyDocumentMap, types.Any)
return args, nil, nil
}

Expand Down

0 comments on commit 357389a

Please sign in to comment.