Skip to content

Commit 9a40639

Browse files
authored
add docs for cognito identity token (#1805)
1 parent 90aa7b8 commit 9a40639

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

docs/ce/howto/project-level-roles.mdx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,15 @@ projects:
2020
aws_role_to_assume:
2121
state: "arn:/blabla/accid/backenddev"
2222
command: "arn:/blabla/accid/devaccount"
23+
aws_role_region: us-east-1
2324
- name: prod
2425
dir: ./prod
2526
aws_role_to_assume:
2627
state: "arn:/blabla/accid/backendprod"
2728
command: "arn:/blabla/accid/prodaccount"
29+
aws_role_region: us-east-1
2830
```
2931

30-
Using a workflow file as usual. Here is an [example repository](https://github.com/diggerhq/demo-assume-role-multi-account-aws_diggeryml) using digger.yml to assume different roles for different projects.
31-
32-
<Note>
33-
NOTE: for locking to be configured user needs to also pass aws-role-to-assume in the workflow file as a
34-
parameter within the workflow file. This role needs to have ability to assume all the other roles and also have access to a common account where the locks are to live.
35-
36-
If you are not using a aws-role-to-assume setting it workflow you **must** add ```AwsRoleRegion``` property to project level ```aws_role_to_assume```
37-
</Note>
38-
3932
You can also use project-level assume role with [generated projects](/ce/howto/generate-projects):
4033

4134
```
@@ -48,3 +41,27 @@ generate_projects:
4841
command: "arn:/blabla/accid/devaccount"
4942
```
5043

44+
# Assume role with cognito identity
45+
46+
The github action JWT token includes alot of useful fields such as `ref`, `sha`, `runner_environment` etc. however it is
47+
challenging to write an AWS trust policy to match for these fields since only `aud` and `sub` fields are supported. Using cognito
48+
identity it is possible to remap the fields into principal tags which allows them to be matched in the trust policy. More information
49+
about this is in this article: https://catnekaise.github.io/github-actions-abac-aws/cognito-identity/.
50+
51+
If you wish to perform this mapping in digger you can specify an additional aws_cognito_oidc configuration as follows:
52+
53+
```
54+
- name: "my-secure-digger-project"
55+
dir: "prod"
56+
workflow: default
57+
workflow_file: digger_workflow.yml
58+
aws_role_to_assume:
59+
aws_role_region: "us-west-2"
60+
command: "arn:aws:iam::00000000000:role/github-action-deployment-role"
61+
aws_cognito_oidc:
62+
cognito_identity_pool_id: "us-east-1:00000000-0000-0000-0000-000000000000"
63+
aws_region: "us-east-1"
64+
aws_account_id: "000000000000"
65+
```
66+
67+
Once this is specified you will be able to match values in additional configuration as highlighted in the url above.

0 commit comments

Comments
 (0)