mirror of
https://github.com/hashicorp/vault.git
synced 2025-12-15 22:41:50 +01: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>
43 lines
968 B
HCL
43 lines
968 B
HCL
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
terraform {
|
|
required_providers {
|
|
enos = {
|
|
source = "registry.terraform.io/hashicorp-forge/enos"
|
|
}
|
|
}
|
|
}
|
|
|
|
locals {
|
|
instances = toset([for idx in range(var.vault_instance_count) : tostring(idx)])
|
|
}
|
|
|
|
resource "enos_remote_exec" "replication_status" {
|
|
for_each = local.instances
|
|
|
|
inline = ["vault read -format=json sys/replication/status"]
|
|
|
|
transport = {
|
|
kubernetes = {
|
|
kubeconfig_base64 = var.kubeconfig_base64
|
|
context_name = var.context_name
|
|
pod = var.vault_pods[each.key].name
|
|
namespace = var.vault_pods[each.key].namespace
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "enos_local_exec" "verify_replication_status" {
|
|
|
|
for_each = enos_remote_exec.replication_status
|
|
|
|
environment = {
|
|
STATUS = each.value.stdout
|
|
VAULT_EDITION = var.vault_edition
|
|
}
|
|
|
|
content = abspath("${path.module}/scripts/smoke-verify-replication.sh")
|
|
}
|