-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathdeployment.tf
98 lines (84 loc) · 2.67 KB
/
deployment.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
variable "stack_version" {
type = string
default = "latest"
description = "the stack version to use"
}
variable "ess_region" {
type = string
default = ""
description = "The ESS region to use"
}
variable "deployment_template_id" {
type = string
default = ""
description = "The ess deployment template to use"
}
variable "creator" {
type = string
default = ""
description = "This is the name who created this deployment"
}
variable "buildkite_id" {
type = string
default = ""
description = "The buildkite build id associated with this deployment"
}
variable "pipeline" {
type = string
default = ""
description = "The buildkite pipeline slug, useful for in combination with the build id to trace back to the pipeline"
}
resource "random_uuid" "deployment_suffix" {
}
locals {
deployment_name = join("-", ["elastic-agent-ci", substr("${random_uuid.deployment_suffix.result}", 0, 8)])
deployment_version = data.ec_stack.latest.version
ess_region = coalesce(var.ess_region, "gcp-us-east1")
deployment_template_id = coalesce(var.deployment_template_id, "gcp-storage-optimized")
}
# If we have defined a stack version, validate that this version exists on that region and return it.
data "ec_stack" "latest" {
version_regex = var.stack_version
region = local.ess_region
}
resource "ec_deployment" "integration-testing" {
name = local.deployment_name
alias = local.deployment_name
region = local.ess_region
deployment_template_id = local.deployment_template_id
version = local.deployment_version
elasticsearch = {
autoscale = false
instance_configuration_id = "gcp.es.datahot.n2.68x10x45"
hot = {
autoscaling = {}
size = "8g"
zone_count = 1
}
}
kibana = {
size = "1g"
zone_count = 1
instance_configuration_id = "gcp.kibana.n2.68x32x45"
config = {
user_settings_json = jsonencode({
"xpack.fleet.enableExperimental" = ["agentTamperProtectionEnabled"]
"xpack.fleet.internal.registry.kibanaVersionCheckEnabled" = false
"server.restrictInternalApis" = false
})
}
}
integrations_server = {
instance_configuration_id = "gcp.integrationsserver.n2.68x32x45"
topology = {
size = "1g"
zone_count = 1
}
}
tags = {
"provisioner" = "elastic-agent-integration-tests"
"creator" = var.creator
"buildkite_id" = var.buildkite_id
"pipeline" = var.pipeline
}
}