Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ data "aws_iam_policy_document" "regression_test_permissions" {
"dynamodb:Scan",
"dynamodb:UpdateItem",
"dynamodb:DeleteItem",
"dynamodb:BatchWriteItem",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Regression tests use BatchWrite to write test data

"dynamodb:DescribeTable",
"dynamodb:DeleteTable",
"dynamodb:TagResource",
Expand All @@ -851,19 +852,21 @@ data "aws_iam_policy_document" "regression_test_permissions" {
sid = "DynamoGlobal"
effect = "Allow"
actions = [
"dynamodb:ListTables",
"dynamodb:CreateTable"
"dynamodb:ListTables",
"dynamodb:CreateTable"
]
resources = ["*"]
}

statement {
sid = "SecretsManagerAccess"
sid = "SecretsManagerAccess"
effect = "Allow"
actions = [
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
]
"secretsmanager:DescribeSecret",
"secretsmanager:UpdateSecretVersionStage",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

UpdateSecretVersionStage and PutSecretValue are used by the regression tests to test hashing/secrets

"secretsmanager:PutSecretValue"
]
resources = ["arn:aws:secretsmanager:${var.default_aws_region}:${data.aws_caller_identity.current.account_id}:secret:eligibility-signposting-api-*"]
}

Expand Down Expand Up @@ -949,8 +952,8 @@ data "aws_iam_policy_document" "github_actions_assume_role" {
dynamic "statement" {
for_each = var.environment == "dev" ? [1] : []
content {
sid = "AllowDevSSORoleToAssumeIamBootstrap"
effect = "Allow"
sid = "AllowDevSSORoleToAssumeIamBootstrap"
effect = "Allow"
actions = ["sts:AssumeRole"]

principals {
Expand All @@ -966,8 +969,8 @@ data "aws_iam_policy_document" "github_actions_assume_role" {
# Assume role policy document for GitHub Actions
data "aws_iam_policy_document" "regression_repo_assume_role" {
statement {
sid = "OidcAssumeRoleWithWebIdentity"
effect = "Allow"
sid = "OidcAssumeRoleWithWebIdentity"
effect = "Allow"
actions = ["sts:AssumeRoleWithWebIdentity"]

principals {
Expand All @@ -980,21 +983,16 @@ data "aws_iam_policy_document" "regression_repo_assume_role" {
condition {
test = "StringLike"
variable = "token.actions.githubusercontent.com:sub"
values = ["repo:${var.github_org}/${var.regression_repo}:*"]
}

condition {
test = "StringLike"
variable = "token.actions.githubusercontent.com:job_workflow_ref"
values = [
"${var.github_org}/${var.regression_repo}/.github/workflows/regression_tests.yml@*"
"repo:${var.github_org}/${var.regression_repo}:*",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We need to allow the role to be assumed by workflows in both the main repo (this one) and the regression test repo

"repo:${var.github_org}/${var.github_repo}:*",
]
}

condition {
test = "StringEquals"
variable = "token.actions.githubusercontent.com:aud"
values = ["sts.amazonaws.com"]
values = ["sts.amazonaws.com"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ data "aws_iam_policy_document" "permissions_boundary" {
}
# Environment-specific actions
dynamic "statement" {
for_each = var.environment == "preprod" ? [1] : []
for_each = contains(["dev", "test", "preprod"], var.environment) ? [1] : []
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We need dynamoDB permissions for the regression test role to be within the permissions boundary for all pre-live environments

content {
sid = "AllowPreprodDynamoDBItemOps"
sid = "AllowDynamoDBItemOps"
effect = "Allow"
actions = [
"dynamodb:GetItem",
Expand Down
Loading