Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of eu-central-1 role #5877

Merged
merged 4 commits into from
Jan 2, 2024
Merged
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
82 changes: 82 additions & 0 deletions terraform/environments/bootstrap/member-bootstrap/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,85 @@ data "aws_iam_policy_document" "policy" {
resources = ["*"] #tfsec:ignore:AWS099 tfsec:ignore:AWS097
}
}

# MemberInfrastructureBedrockEuCentral
module "member-access-eu-central" {
count = local.account_data.account-type == "member" && terraform.workspace != "testing-test" ? 1 : 0
source = "github.com/ministryofjustice/modernisation-platform-terraform-cross-account-access?ref=v2.3.0"
account_id = local.modernisation_platform_account.id
additional_trust_roles = [one(data.aws_iam_roles.github_actions_role.arns), one(data.aws_iam_roles.member-sso-admin-access.arns)]
policy_arn = aws_iam_policy.member-access-us-east[0].id
role_name = "MemberInfrastructureBedrockEuCentral"
}

# lots of SCA ignores and skips on this one as it is the main role allowing members to build most things in the platform
#tfsec:ignore:aws-iam-no-policy-wildcards
data "aws_iam_policy_document" "member-access-eu-central" {
statement {
#checkov:skip=CKV_AWS_108
#checkov:skip=CKV_AWS_111
#checkov:skip=CKV_AWS_107
#checkov:skip=CKV_AWS_109
#checkov:skip=CKV_AWS_110
#checkov:skip=CKV2_AWS_40
effect = "Allow"
actions = [
"bedrock:*"
]
resources = ["*"] #tfsec:ignore:AWS099 tfsec:ignore:AWS097
}
statement {
effect = "Deny"
actions = [
"iam:AddClientIDToOpenIDConnectProvider",
"iam:AddUserToGroup",
"iam:AttachGroupPolicy",
"iam:AttachUserPolicy",
"iam:CreateAccountAlias",
"iam:CreateGroup",
"iam:CreateLoginProfile",
"iam:CreateOpenIDConnectProvider",
"iam:CreateSAMLProvider",
"iam:CreateUser",
"iam:CreateVirtualMFADevice",
"iam:DeactivateMFADevice",
"iam:DeleteAccountAlias",
"iam:DeleteAccountPasswordPolicy",
"iam:DeleteGroup",
"iam:DeleteGroupPolicy",
"iam:DeleteLoginProfile",
"iam:DeleteOpenIDConnectProvider",
"iam:DeleteSAMLProvider",
"iam:DeleteUser",
"iam:DeleteUserPermissionsBoundary",
"iam:DeleteUserPolicy",
"iam:DeleteVirtualMFADevice",
"iam:DetachGroupPolicy",
"iam:DetachUserPolicy",
"iam:EnableMFADevice",
"iam:RemoveClientIDFromOpenIDConnectProvider",
"iam:RemoveUserFromGroup",
"iam:ResyncMFADevice",
"iam:UpdateAccountPasswordPolicy",
"iam:UpdateGroup",
"iam:UpdateLoginProfile",
"iam:UpdateOpenIDConnectProviderThumbprint",
"iam:UpdateSAMLProvider",
"iam:UpdateUser"
]
resources = ["*"]
}

statement {
effect = "Deny"
actions = ["*"]
resources = ["*"]
}
}

resource "aws_iam_policy" "member-access-eu-central" {
count = local.account_data.account-type == "member" ? 1 : 0
name = "MemberInfrastructureBedrockEuCentralActions"
description = "Restricted policy for US East usage"
policy = data.aws_iam_policy_document.member-access-eu-central.json
}