diff --git a/testing/benchmarking/main.tf b/testing/benchmarking/main.tf index 659e88f4..2b0ad57b 100644 --- a/testing/benchmarking/main.tf +++ b/testing/benchmarking/main.tf @@ -31,8 +31,15 @@ provider "ec" {} provider "aws" { region = var.aws_region + default_tags { + tags = module.tags.tags + } } +module "tags" { + source = "github.com/elastic/apm-server//testing/infra/terraform/modules/tags?depth=1" + project = "lambda-extension-benchmarks" +} module "ec_deployment" { source = "github.com/elastic/apm-server/testing/infra/terraform/modules/ec_deployment" @@ -49,6 +56,8 @@ module "ec_deployment" { integrations_server = true apm_server_expvar = false apm_server_pprof = false + + tags = module.tags.tags } module "lambda_deployment" { diff --git a/tf/main.tf b/tf/main.tf index c68c701b..5e794f6d 100644 --- a/tf/main.tf +++ b/tf/main.tf @@ -2,6 +2,11 @@ provider "aws" { region = var.aws_region } +module "tags" { + source = "github.com/elastic/apm-server//testing/infra/terraform/modules/tags?depth=1" + project = var.user_name +} + module "ec_deployment" { source = "github.com/elastic/apm-server//testing/infra/terraform/modules/ec_deployment?depth=1" deployment_name_prefix = "apm-aws-lambda-smoke-testing" @@ -11,6 +16,7 @@ module "ec_deployment" { region = var.ess_region deployment_template = var.ess_deployment_template stack_version = var.ess_version + tags = module.tags.tags } module "lambda_function" { @@ -35,9 +41,9 @@ module "lambda_function" { ELASTIC_APM_SECRET_TOKEN = module.ec_deployment.apm_secret_token } - tags = { + tags = merge(module.tags.tags, { Name = "my-lambda" - } + }) } module "lambda_layer_local" { @@ -50,4 +56,6 @@ module "lambda_layer_local" { compatible_runtimes = ["nodejs16.x"] source_path = "../bin/" + + tags = module.tags.tags } diff --git a/tf/variables.tf b/tf/variables.tf index a3e419c8..8c3c9f8b 100644 --- a/tf/variables.tf +++ b/tf/variables.tf @@ -4,6 +4,11 @@ variable "aws_region" { default = "eu-central-1" } +variable "user_name" { + description = "Required username to use for prefixes" + type = string +} + variable "log_level" { type = string description = "lambda extension log level"