Skip to content

Commit c9d7599

Browse files
authored
Merge pull request #50 from ONS-Innovation/KEH-2171-Assume-Service-Role-SSO
KEH-2171: Assume Service Role via SSO
2 parents 8b3b9b3 + c4efd1c commit c9d7599

4 files changed

Lines changed: 26 additions & 94 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ Install dev dependencies to run linting tools
4747
make install-dev
4848
```
4949

50+
Sign in with AWS SSO, and export the correct profile for this service:
51+
52+
```bash
53+
aws sso login
54+
55+
export AWS_PROFILE=keh-tech-audit-tool-api
56+
```
57+
58+
This allows you to assume the AWS IAM role for the service, enabling the most secure development experience. This also means you will have limited permissions until you exit out of the profile.
59+
60+
**Note:** See the Developer Onboarding Guide on the "Using AWS SSO for Local Development" page on Confluence to set up service profile selection on your local machine.
61+
5062
Set environment variables:
5163

5264
```bash

terraform/lambda/iam.tf

Lines changed: 0 additions & 79 deletions
This file was deleted.

terraform/lambda/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ resource "aws_iam_role" "lambda_execution_role" {
2222
Principal = {
2323
Service = "lambda.amazonaws.com"
2424
}
25+
},
26+
{
27+
Action = "sts:AssumeRole"
28+
Effect = "Allow"
29+
Principal = {
30+
AWS = "arn:aws:iam::${var.aws_account_id}:root"
31+
}
32+
Condition = {
33+
ArnLike = {
34+
"aws:PrincipalArn" = [
35+
"arn:aws:iam::${var.aws_account_id}:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_Standard_Administrator_Access_*"
36+
]
37+
}
38+
}
2539
}
2640
]
2741
})

terraform/lambda/secrets.tf

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)