mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-23 15:41:07 +02:00
Add `config_mode` variant to some scenarios so we can dynamically change how we primarily configure the Vault cluster, either by a configuration file or with environment variables. As part of this change we also: * Start consuming the Enos terraform provider from public Terraform registry. * Remove the old `seal_ha_beta` variant as it is no longer required. * Add a module that performs a `vault operator step-down` so that we can force leader elections in scenarios. * Wire up an operator step-down into some scenarios to test both the old and new multiseal code paths during leader elections. Signed-off-by: Ryan Cragun <me@ryan.ec>
44 lines
928 B
HCL
44 lines
928 B
HCL
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
terraform {
|
|
required_providers {
|
|
enos = {
|
|
source = "registry.terraform.io/hashicorp-forge/enos"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "vault_instance_count" {
|
|
type = number
|
|
description = "How many vault instances are in the cluster"
|
|
}
|
|
|
|
variable "old_vault_instances" {
|
|
type = map(object({
|
|
private_ip = string
|
|
public_ip = string
|
|
}))
|
|
description = "The vault cluster instances to be shutdown"
|
|
}
|
|
|
|
locals {
|
|
public_ips = {
|
|
for idx in range(var.vault_instance_count) : idx => {
|
|
public_ip = values(var.old_vault_instances)[idx].public_ip
|
|
private_ip = values(var.old_vault_instances)[idx].private_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "enos_remote_exec" "shutdown_multiple_nodes" {
|
|
for_each = local.public_ips
|
|
inline = ["sudo shutdown -H --no-wall; exit 0"]
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = each.value.public_ip
|
|
}
|
|
}
|
|
}
|