Skip to content

Commit 002796b

Browse files
committed
Push ec_target down to ec_deployment
1 parent e8f8dfa commit 002796b

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

testing/benchmark/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ locals {
2929
project = "apm-server-benchmarks"
3030
ec_target = lower(var.ec_target)
3131
api_endpoints = {
32-
qa = "https://public-api.qa.cld.elstc.co"
33-
pro = "https://api.elastic-cloud.com"
32+
qa = "https://public-api.qa.cld.elstc.co"
33+
pro = "https://api.elastic-cloud.com"
3434
}
3535
}
3636

@@ -99,6 +99,7 @@ module "ec_deployment" {
9999
count = var.run_standalone ? 0 : 1
100100
source = "../infra/terraform/modules/ec_deployment"
101101

102+
ec_target = var.ec_target
102103
region = var.ess_region
103104
stack_version = var.stack_version
104105

testing/benchmark/outputs.tf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
locals {
2-
ec_target = lower(var.ec_target)
3-
adminconsole_urls = {
4-
qa = "https://admin.qa.cld.elstc.co"
5-
pro = "https://cloud.elastic.co"
6-
}
7-
ec_console_url = local.adminconsole_urls[local.ec_target]
8-
}
9-
101
output "public_ip" {
112
value = module.benchmark_worker.public_ip
123
description = "The worker public IP"
@@ -57,6 +48,6 @@ output "moxy_ip" {
5748
}
5849

5950
output "admin_console_url" {
60-
value = var.run_standalone ? "${local.ec_console_url}/deployments" : "${local.ec_console_url}/deployments/${module.ec_deployment[0].deployment_id}/integrations_server"
51+
value = var.run_standalone ? "https://cloud.elastic.co/deployments" : module.ec_deployment[0].admin_console_url
6152
description = "The admin console URL"
6253
}

testing/infra/terraform/modules/ec_deployment/outputs.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
locals {
2+
admin_console_urls = {
3+
qa = "https://admin.qa.cld.elstc.co"
4+
pro = "https://cloud.elastic.co"
5+
}
6+
}
7+
18
output "deployment_id" {
29
value = ec_deployment.deployment.id
310
description = "The deployment ID for the created cluster"
@@ -46,7 +53,7 @@ output "stack_version" {
4653
}
4754

4855
output "admin_console_url" {
49-
value = "https://admin.found.no/deployments/${ec_deployment.deployment.id}/integrations_server"
56+
value = "${local.admin_console_urls[lower(var.ec_target)]}/deployments/${ec_deployment.deployment.id}/integrations_server"
5057
}
5158

5259
output "ech_apm_component_id" {

testing/infra/terraform/modules/ec_deployment/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ variable "deployment_template" {
1818
type = string
1919
}
2020

21+
variable "ec_target" {
22+
default = "pro"
23+
description = "Elastic Cloud target for endpoint-specific links"
24+
type = string
25+
validation {
26+
condition = contains(["qa", "pro"], lower(var.ec_target))
27+
error_message = "ec_target must be one of: qa, pro"
28+
}
29+
}
30+
2131
variable "stack_version" {
2232
default = "latest"
2333
description = "Optional stack version"

0 commit comments

Comments
 (0)