From 7d036511de80ac4e33476f7494deae90a93ac903 Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Thu, 28 Sep 2023 20:42:24 +0300 Subject: [PATCH] gitlab-runners workers instance types as a variable --- Makefile | 9 +++++++++ modules/gitlab-runners/main.tf | 10 +++++----- modules/gitlab-runners/variables.tf | 6 ++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3b94b5d..1fd0c56 100644 --- a/Makefile +++ b/Makefile @@ -29,9 +29,18 @@ tf/apply/audit: tf/apply/gitlab-permissions: cd live/${ENV}/gitlab-permissions && terragrunt run-all --terragrunt-non-interactive apply -auto-approve +tf/init/gitlab-runners: + cd live/${ENV}/gitlab-runners && terragrunt run-all --terragrunt-non-interactive init + +tf/plan/gitlab-runners: + cd live/${ENV}/gitlab-runners && terragrunt run-all --terragrunt-non-interactive plan + tf/apply/gitlab-runners: cd live/${ENV}/gitlab-runners && terragrunt run-all --terragrunt-non-interactive apply -auto-approve +tf/destroy/gitlab-runners: + cd live/${ENV}/gitlab-runners && terragrunt run-all --terragrunt-non-interactive destroy + tf/apply/oidc: cd live/${ENV}/oidc && terragrunt run-all --terragrunt-non-interactive apply -auto-approve diff --git a/modules/gitlab-runners/main.tf b/modules/gitlab-runners/main.tf index ac66eed..10809d3 100644 --- a/modules/gitlab-runners/main.tf +++ b/modules/gitlab-runners/main.tf @@ -70,7 +70,7 @@ module "runner-instance-1" { } runner_worker_cache = { - bucket_prefix = "1-" + bucket_prefix = "1" create = "true" versioning = "true" shared = "true" @@ -132,7 +132,7 @@ module "runner-instance-1" { } runner_worker_docker_machine_instance = { - types = ["t3.micro"] + types = var.docker-machine-types } runner_networking = { @@ -167,7 +167,7 @@ module "runner-instance-2" { } runner_worker_cache = { - bucket_prefix = "2-" + bucket_prefix = "2" create = "true" versioning = "true" shared = "true" @@ -229,7 +229,7 @@ module "runner-instance-2" { } runner_worker_docker_machine_instance = { - types = ["t3.micro"] + types = var.docker-machine-types } runner_networking = { @@ -241,6 +241,6 @@ module "runner-instance-2" { runner_role = { role_profile_name = "runner-2" } - iam_object_prefix = "2-" + iam_object_prefix = "2" runner_terminate_ec2_lifecycle_hook_name = "terminate-instances-2" } diff --git a/modules/gitlab-runners/variables.tf b/modules/gitlab-runners/variables.tf index 10a750e..fcf92f6 100644 --- a/modules/gitlab-runners/variables.tf +++ b/modules/gitlab-runners/variables.tf @@ -70,3 +70,9 @@ variable "user" { description = "User name" type = string } + +variable "docker-machine-types" { + description = "Gitlab runner docker machine type" + type = list(string) + default = ["t3.micro"] +}