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

🤐 Add secret for APC GitHub App #8639

Merged
merged 2 commits into from
Nov 12, 2024
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 @@ -198,29 +198,18 @@ data "aws_iam_policy_document" "analytical_platform_share_policy" {
"lakeformation:DescribeResource",
"lakeformation:GetDataAccess",
]
resources = [
"arn:aws:lakeformation:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:catalog:${data.aws_caller_identity.current.account_id}"
]
resources = ["arn:aws:lakeformation:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:catalog:${data.aws_caller_identity.current.account_id}"]
}

statement {
effect = "Allow"
actions = [
"iam:PutRolePolicy"
]
resources = [
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-service-role/lakeformation.amazonaws.com/AWSServiceRoleForLakeFormationDataAccess"
]
effect = "Allow"
actions = ["iam:PutRolePolicy"]
resources = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-service-role/lakeformation.amazonaws.com/AWSServiceRoleForLakeFormationDataAccess"]
}
# Needed for LakeFormationAdmin to check the presense of the Lake Formation Service Role
statement {
effect = "Allow"
actions = [
"iam:CreateServiceLinkedRole"
]
resources = [
"*"
]
effect = "Allow"
actions = ["iam:CreateServiceLinkedRole"]
resources = ["*"]
condition {
test = "StringEquals"
variable = "iam:AWSServiceName"
Expand All @@ -243,21 +232,16 @@ data "aws_iam_policy_document" "analytical_platform_share_policy" {
"s3:*",
"quicksight:*"
]
resources = [
"*"
]
resources = ["*"]
}
statement {
effect = "Allow"
actions = [
"ram:CreateResourceShare",
"ram:DeleteResourceShare"
]
resources = [
"arn:aws:ram:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:resource-share/*"
]
resources = ["arn:aws:ram:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:resource-share/*"]
}

statement {
effect = "Allow"
actions = [
Expand All @@ -282,6 +266,11 @@ module "analytical_platform_lake_formation_share_policy" {
}

data "aws_iam_policy_document" "quicksight_vpc_connection" {
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions
#checkov:skip=CKV_TF_2:Module registry does not support tags for versions
#checkov:skip=CKV_AWS_111:Policy suggested by AWS documentation
#checkov:skip=CKV_AWS_356:Policy suggested by AWS documentation

statement {
sid = "QuickSightVPCConnection"
effect = "Allow"
Expand Down
24 changes: 24 additions & 0 deletions terraform/environments/analytical-platform-compute/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,27 @@ module "actions_runners_token_apc_self_hosted_runners_secret" {
}
)
}

module "actions_runners_token_apc_self_hosted_runners_github_app" {
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions
#checkov:skip=CKV_TF_2:Module registry does not support tags for versions

count = terraform.workspace == "analytical-platform-compute-production" ? 1 : 0

source = "terraform-aws-modules/secrets-manager/aws"
version = "1.3.1"

name = "actions-runners/app/apc-self-hosted-runners"
description = "https://github.com/organizations/moj-analytical-services/settings/installations/57058653"
kms_key_id = module.common_secrets_manager_kms.key_arn

secret_string = jsonencode({
app_id = "CHANGEME",
client_id = "CHANGEME",
installation_id = "CHANGEME",
private_key = "CHANGEME"
})
ignore_secret_changes = true

tags = local.tags
}
Loading