diff --git a/main.tf b/main.tf index 85d69d0..9617ad1 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,7 @@ locals { image_uri = "${var.ecr_repo_url}:${var.from_env}" artifacts_bucket_name = "s3-codepipeline-${var.app_name}-${var.env_type}" + run_tests = var.run_integration_tests || var.run_stress_tests ? true : false } module "ci-cd-code-pipeline" { @@ -33,7 +34,7 @@ module "build" { s3_bucket = local.artifacts_bucket_name privileged_mode = true environment_variables_parameter_store = var.environment_variables_parameter_store - environment_variables = merge(var.environment_variables, { APPSPEC = templatefile("${path.module}/templates/appspec.json.tpl", { APP_NAME = "${var.app_name}", ENV_TYPE = "${var.env_type}", HOOKS = var.run_integration_tests, PIPELINE_TYPE = var.pipeline_type})}) //TODO: try to replace with file + environment_variables = merge(var.environment_variables, { APPSPEC = templatefile("${path.module}/templates/appspec.json.tpl", { APP_NAME = "${var.app_name}", ENV_TYPE = "${var.env_type}", HOOKS = local.run_tests, PIPELINE_TYPE = var.pipeline_type})}) //TODO: try to replace with file buildspec_file = templatefile("buildspec.yml.tpl", { APP_NAME = var.app_name, ENV_TYPE = var.env_type, diff --git a/templates/appspec.json.tpl b/templates/appspec.json.tpl index 68f2c5f..5493705 100644 --- a/templates/appspec.json.tpl +++ b/templates/appspec.json.tpl @@ -17,7 +17,7 @@ "Hooks": [ %{ if HOOKS } { - "AfterAllowTestTraffic": "${APP_NAME}-${ENV_TYPE}-test-framework" + "AfterAllowTestTraffic": "${APP_NAME}-${ENV_TYPE}-test-framework-manager" }, %{ endif } %{ if PIPELINE_TYPE != "dev" } diff --git a/variables.tf b/variables.tf index 1ba3ff9..7f12691 100644 --- a/variables.tf +++ b/variables.tf @@ -19,6 +19,11 @@ variable "run_integration_tests" { default = false } +variable "run_stress_tests" { + type = bool + default = false +} + variable "ecr_repo_url" { type = string }