Files
Juana De La Cuesta c5d74a96a3 Add module to upgrade clients (#25055)
* func: add module to upgrade clients

* func: add polling to verify the metadata to make sure all clients are up

* style: remove unused code

* fix: Give the allocations a little time to get to the expected number on teh test health check, to avoid possible flaky tests in the future

* fix: set the upgrade version as clients version for the last health check
2025-02-10 17:03:54 +01:00

58 lines
1.2 KiB
HCL

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
terraform {
required_providers {
enos = {
source = "registry.terraform.io/hashicorp-forge/enos"
}
}
}
locals {
binary_destination = var.platform == "windows" ? "C:/opt/" : "/usr/local/bin/"
ssh_user = var.platform == "windows" ? "Administrator" : "ubuntu"
ssh_config = {
host = var.instance_address
private_key_path = var.ssh_key_path
user = local.ssh_user
}
}
resource "enos_bundle_install" "nomad" {
destination = local.binary_destination
artifactory = var.artifactory_release
transport = {
ssh = local.ssh_config
}
}
resource "enos_remote_exec" "restart_linux_services" {
count = var.platform == "linux" ? 1 : 0
depends_on = [enos_bundle_install.nomad]
transport = {
ssh = local.ssh_config
}
inline = [
"sudo systemctl restart nomad",
]
}
resource "enos_remote_exec" "restart_windows_services" {
count = var.platform == "windows" ? 1 : 0
depends_on = [enos_bundle_install.nomad]
transport = {
ssh = local.ssh_config
}
inline = [
"powershell Restart-Service Nomad"
]
}