File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
dev-tools/cloud/terraform Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,28 @@ variable "pull_request" {
2828 description = " The github pull request number."
2929}
3030
31+ variable "ess_region" {
32+ type = string
33+ default = " gcp-us-west2"
34+ description = " The ESS region to use"
35+ }
36+
3137locals {
32- match = regex (" const DefaultVersion = \" (.*)\" " , file (" ${ path . module } /../../../version/version.go" ))[0 ]
33- stack_version = format (" %s-SNAPSHOT" , local. match )
38+ // strip hash found in ELASTICSEARCH_VERSION in integration/.env to get stack_version
39+ dra_match = regex (" ELASTICSEARCH_VERSION=([0-9]+\\ .[0-9]+\\ .[0-9]+)(?:-[[:alpha:]]+-)?-?(SNAPSHOT)?" , file (" ${ path . module } /../../integration/.env" ))
40+ stack_version = local. dra_match [1 ] == " SNAPSHOT" ? format (" %s-SNAPSHOT" , local. dra_match [0 ]) : local. dra_match [0 ]
3441 docker_image_ea = var. elastic_agent_docker_image
3542}
3643
44+ data "ec_stack" "latest" {
45+ version_regex = local. stack_version
46+ region = var. ess_region
47+ }
48+
3749resource "ec_deployment" "deployment" {
3850 name = format (" fleet server PR-%s-%s" , var. pull_request , var. git_commit )
39- region = " gcp-us-west2 "
40- version = local . stack_version
51+ region = var . ess_region
52+ version = data . ec_stack . latest . version
4153 deployment_template_id = " gcp-general-purpose"
4254
4355 tags = {
Original file line number Diff line number Diff line change 11output "stack_version" {
2- value = local . stack_version
2+ value = data . ec_stack . latest . version
33 description = " Stack version"
44}
55
You can’t perform that action at this time.
0 commit comments