Skip to content

Commit 41e5179

Browse files
fix: label terraform ECH deployments (#15884) (#15907)
(cherry picked from commit 5d8abfa) Co-authored-by: Ivan Fernandez Calvo <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 00aaaf2 commit 41e5179

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

testing/smoke/main.tf

+41
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ terraform {
1010

1111
provider "ec" {}
1212

13+
module "tags" {
14+
source = "../infra/terraform/modules/tags"
15+
project = "apm-server"
16+
}
17+
18+
locals {
19+
ci_tags = {
20+
environment = coalesce(var.ENVIRONMENT, "dev")
21+
repo = coalesce(var.REPO, "apm-server")
22+
branch = var.BRANCH
23+
build = var.BUILD_ID
24+
created_date = var.CREATED_DATE
25+
subproject = "smoke-test"
26+
}
27+
}
28+
1329
module "ec_deployment" {
1430
source = "../../infra/terraform/modules/ec_deployment"
1531
region = var.region
@@ -24,6 +40,7 @@ module "ec_deployment" {
2440

2541
stack_version = var.stack_version
2642
integrations_server = var.integrations_server
43+
tags = merge(local.ci_tags, module.tags.tags)
2744
}
2845

2946
variable "stack_version" {
@@ -82,3 +99,27 @@ output "stack_version" {
8299
value = module.ec_deployment.stack_version
83100
description = "The matching stack pack version from the provided stack_version"
84101
}
102+
103+
# CI variables
104+
variable "BRANCH" {
105+
description = "Branch name or pull request for tagging purposes"
106+
default = "unknown"
107+
}
108+
109+
variable "BUILD_ID" {
110+
description = "Build ID in the CI for tagging purposes"
111+
default = "unknown"
112+
}
113+
114+
variable "CREATED_DATE" {
115+
description = "Creation date in epoch time for tagging purposes"
116+
default = "unknown"
117+
}
118+
119+
variable "ENVIRONMENT" {
120+
default = "unknown"
121+
}
122+
123+
variable "REPO" {
124+
default = "unknown"
125+
}

testing/smoke/managed/main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider "ec" {}
1212

1313
module "tags" {
1414
source = "../../infra/terraform/modules/tags"
15-
project = "smoke-test-ea-managed"
15+
project = "apm-server"
1616
}
1717

1818
locals {
@@ -22,6 +22,7 @@ locals {
2222
branch = var.BRANCH
2323
build = var.BUILD_ID
2424
created_date = var.CREATED_DATE
25+
subproject = "smoke-test-ea-managed"
2526
}
2627
}
2728

testing/smoke/supported-os/main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider "ec" {}
1212

1313
module "tags" {
1414
source = "../../infra/terraform/modules/tags"
15-
project = "smoke-test-supported-os"
15+
project = "apm-server"
1616
}
1717

1818
locals {
@@ -22,6 +22,7 @@ locals {
2222
branch = var.BRANCH
2323
build = var.BUILD_ID
2424
created_date = var.CREATED_DATE
25+
subproject = "smoke-test-supported-os"
2526
}
2627
}
2728

0 commit comments

Comments
 (0)