From e9493711adc4ee679152e854801ac9069056bca2 Mon Sep 17 00:00:00 2001 From: Jacob Woffenden Date: Thu, 30 May 2024 16:18:42 +0000 Subject: [PATCH] Add CaDeT Helm chart Signed-off-by: Jacob Woffenden --- .../helm-charts-actions-runners.tf | 29 +++++++++++++++++++ .../analytical-platform-compute/secrets.tf | 7 ++++- .../create-a-derived-table/values.yml.tftpl | 13 +++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 terraform/environments/analytical-platform-compute/helm-charts-actions-runners.tf create mode 100644 terraform/environments/analytical-platform-compute/src/helm/values/actions-runners/create-a-derived-table/values.yml.tftpl diff --git a/terraform/environments/analytical-platform-compute/helm-charts-actions-runners.tf b/terraform/environments/analytical-platform-compute/helm-charts-actions-runners.tf new file mode 100644 index 00000000000..ae7a380f121 --- /dev/null +++ b/terraform/environments/analytical-platform-compute/helm-charts-actions-runners.tf @@ -0,0 +1,29 @@ +data "aws_secretsmanager_secret_version" "actions_runners_create_a_derived_table" { + count = terraform.workspace == "analytical-platform-compute-production" ? 1 : 0 + + secret_id = module.actions_runners_create_a_derived_table_secret[0].secret_id +} + +resource "helm_release" "actions_runner_mojas_create_a_derived_table" { + count = terraform.workspace == "analytical-platform-compute-production" ? 1 : 0 + + /* https://github.com/ministryofjustice/analytical-platform-actions-runner */ + name = "actions-runner-mojas-create-a-derived-table" + repository = "oci://ghcr.io/ministryofjustice/analytical-platform-charts" + version = "2.316.1" + chart = "actions-runner" + namespace = kubernetes_namespace.actions_runners[0].metadata[0].name + values = [ + templatefile( + "${path.module}/src/helm/values/actions-runners/create-a-derived-table/values.yml.tftpl", + { + replicaCount = 2 + github_organisation = "moj-analytical-services" + github_repository = "create-a-derived-table" + github_token = data.aws_secretsmanager_secret_version.actions_runners_create_a_derived_table[0].secret_string + github_runner_labels = "analytical-platform" + eks_role_arn = "arn:aws:iam::593291632749:role/create-a-derived-table" + } + ) + ] +} diff --git a/terraform/environments/analytical-platform-compute/secrets.tf b/terraform/environments/analytical-platform-compute/secrets.tf index 709e711ba50..4013493b5fa 100644 --- a/terraform/environments/analytical-platform-compute/secrets.tf +++ b/terraform/environments/analytical-platform-compute/secrets.tf @@ -1,4 +1,4 @@ -module "actions_runners_create_a_derived_table" { +module "actions_runners_create_a_derived_table_secret" { #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 @@ -20,3 +20,8 @@ module "actions_runners_create_a_derived_table" { } ) } + +moved { + from = module.actions_runners_create_a_derived_table + to = module.actions_runners_create_a_derived_table_secret +} diff --git a/terraform/environments/analytical-platform-compute/src/helm/values/actions-runners/create-a-derived-table/values.yml.tftpl b/terraform/environments/analytical-platform-compute/src/helm/values/actions-runners/create-a-derived-table/values.yml.tftpl new file mode 100644 index 00000000000..e17718dd1e9 --- /dev/null +++ b/terraform/environments/analytical-platform-compute/src/helm/values/actions-runners/create-a-derived-table/values.yml.tftpl @@ -0,0 +1,13 @@ +--- +replicaCount: ${replicaCount} + +github: + organisation: ${github_organisation} + repository: ${github_repository} + token: ${github_token} + runner: + labels: ${github_runner_labels} + +serviceAccount: + annotations: + eks.amazonaws.com/role-arn: ${eks_role_arn} \ No newline at end of file