From 44a71ca0f09cd3182551a3559d91d07541e2372b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:22:30 +0000 Subject: [PATCH] terraform: add apm-server prefix to benchmarks (#14914) (#14916) Adds the apm-server prefix to the benchmarks project tag to facilitate filtering for project. Signed-off-by: Marc Lopez Rubio (cherry picked from commit f4937b478a5bb83ba32a64bbe273e9377dfe66c3) Co-authored-by: Marc Lopez Rubio Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- testing/benchmark/main.tf | 6 +++++- testing/infra/terraform/modules/rally_workers/main.tf | 5 +++-- testing/infra/terraform/modules/soaktest_workers/main.tf | 4 ---- .../infra/terraform/modules/soaktest_workers/provider.tf | 4 ++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/testing/benchmark/main.tf b/testing/benchmark/main.tf index 4b888e7a78a..bf58ee76e27 100644 --- a/testing/benchmark/main.tf +++ b/testing/benchmark/main.tf @@ -26,19 +26,23 @@ locals { build = var.BUILD_ID created_date = coalesce(var.CREATED_DATE, time_static.created_date.unix) } + project = "apm-server-benchmarks" } module "tags" { source = "../infra/terraform/modules/tags" # use the convention for team/shared owned resources if we are running in CI. # assume this is an individually owned resource otherwise. - project = startswith(var.user_name, "benchci") ? "benchmarks" : var.user_name + project = startswith(var.user_name, "benchci") ? local.project : "${local.project}-${var.user_name}" } provider "ec" {} provider "aws" { region = var.worker_region + default_tags { + tags = merge(local.ci_tags, module.tags.labels) + } } locals { diff --git a/testing/infra/terraform/modules/rally_workers/main.tf b/testing/infra/terraform/modules/rally_workers/main.tf index a61c7ee5e19..996c13de00b 100644 --- a/testing/infra/terraform/modules/rally_workers/main.tf +++ b/testing/infra/terraform/modules/rally_workers/main.tf @@ -1,6 +1,7 @@ provider "google" { - project = var.gcp_project - region = var.gcp_region + project = var.gcp_project + region = var.gcp_region + default_labels = module.tags } locals { diff --git a/testing/infra/terraform/modules/soaktest_workers/main.tf b/testing/infra/terraform/modules/soaktest_workers/main.tf index 00254f20cfb..e5af9451595 100644 --- a/testing/infra/terraform/modules/soaktest_workers/main.tf +++ b/testing/infra/terraform/modules/soaktest_workers/main.tf @@ -72,10 +72,6 @@ resource "google_compute_instance" "worker" { access_config {} } - labels = merge(module.tags.labels, { - workspace = terraform.workspace - }) - metadata = { ssh-keys = "${local.ssh_user_name}:${data.tls_public_key.worker_login.public_key_openssh}" } diff --git a/testing/infra/terraform/modules/soaktest_workers/provider.tf b/testing/infra/terraform/modules/soaktest_workers/provider.tf index f8d8d2a2f89..92f1b67e817 100644 --- a/testing/infra/terraform/modules/soaktest_workers/provider.tf +++ b/testing/infra/terraform/modules/soaktest_workers/provider.tf @@ -2,4 +2,8 @@ provider "google" { project = var.gcp_project region = var.gcp_region zone = var.gcp_zone + + default_labels = merge(module.tags.labels, { + workspace = terraform.workspace + }) }