9da2fc4b8b
Rather than assuming a short sleep will work, we instead wait until netcat is listening of the socket. We've also configured the netcat listener to persist after the first connection, which allows Vault and us to check the connection without the process closing. As we implemented this we also ran into AWS issues in us-east-1 and us-west-2, so we've changed our deploy regions until those issues are resolved. Signed-off-by: Ryan Cragun <me@ryan.ec>
49 lines
1.1 KiB
HCL
49 lines
1.1 KiB
HCL
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
terraform {
|
|
required_providers {
|
|
enos = {
|
|
source = "app.terraform.io/hashicorp-qti/enos"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "vault_install_dir" {
|
|
type = string
|
|
description = "The directory where the Vault binary will be installed"
|
|
}
|
|
|
|
variable "vault_instance_count" {
|
|
type = number
|
|
description = "How many vault instances are in the cluster"
|
|
}
|
|
|
|
variable "node_public_ips" {
|
|
type = list(string)
|
|
description = "Vault cluster node Public IP address"
|
|
}
|
|
|
|
locals {
|
|
followers = toset([for idx in range(var.vault_instance_count - 1) : tostring(idx)])
|
|
vault_bin_path = "${var.vault_install_dir}/vault"
|
|
}
|
|
|
|
resource "enos_remote_exec" "verify_kv_on_node" {
|
|
for_each = {
|
|
for idx, follower in local.followers : idx => follower
|
|
}
|
|
environment = {
|
|
VAULT_ADDR = "http://127.0.0.1:8200"
|
|
VAULT_INSTALL_DIR = var.vault_install_dir
|
|
}
|
|
|
|
scripts = [abspath("${path.module}/scripts/verify-data.sh")]
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = element(var.node_public_ips, each.key)
|
|
}
|
|
}
|
|
}
|