mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 07:01:09 +02:00
* VAULT-29583: Modernize default distributions in enos scenarios Our scenarios have been running the last gen of distributions in CI. This updates our default distributions as follows: - Amazon: 2023 - Leap: 15.6 - RHEL: 8.10, 9.4 - SLES: 15.6 - Ubuntu: 20.04, 24.04 With these changes we also unlock a few new variants combinations: - `distro:amzn seal:pkcs11` - `arch:arm64 distro:leap` We also normalize our distro key for Amazon Linux to `amzn`, which matches the uname output on both versions that we've supported. Signed-off-by: Ryan Cragun <me@ryan.ec>
84 lines
1.7 KiB
HCL
84 lines
1.7 KiB
HCL
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
terraform {
|
|
required_providers {
|
|
enos = {
|
|
source = "registry.terraform.io/hashicorp-forge/enos"
|
|
version = ">= 0.4.9"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "hosts" {
|
|
type = map(object({
|
|
ipv6 = string
|
|
private_ip = string
|
|
public_ip = string
|
|
}))
|
|
description = "The hosts for whom default softhsm configuration will be applied"
|
|
}
|
|
|
|
variable "skip" {
|
|
type = bool
|
|
default = false
|
|
description = "Whether or not to skip initializing softhsm"
|
|
}
|
|
|
|
locals {
|
|
// The location on disk to write the softhsm tokens to
|
|
token_dir = "/var/lib/softhsm/tokens"
|
|
|
|
// Where the default configuration is
|
|
config_paths = {
|
|
"amzn" = "/etc/softhsm2.conf"
|
|
"rhel" = "/etc/softhsm2.conf"
|
|
"ubuntu" = "/etc/softhsm/softhsm2.conf"
|
|
}
|
|
|
|
host_key = element(keys(enos_host_info.hosts), 0)
|
|
config_path = local.config_paths[enos_host_info.hosts[local.host_key].distro]
|
|
}
|
|
|
|
resource "enos_host_info" "hosts" {
|
|
for_each = var.hosts
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = each.value.public_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "enos_remote_exec" "init_softhsm" {
|
|
for_each = var.hosts
|
|
depends_on = [enos_host_info.hosts]
|
|
|
|
environment = {
|
|
CONFIG_PATH = local.config_paths[enos_host_info.hosts[each.key].distro]
|
|
TOKEN_DIR = local.token_dir
|
|
SKIP = var.skip ? "true" : "false"
|
|
}
|
|
|
|
scripts = [abspath("${path.module}/scripts/init-softhsm.sh")]
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = each.value.public_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
output "config_path" {
|
|
// Technically this is actually just the first config path of our hosts.
|
|
value = local.config_path
|
|
}
|
|
|
|
output "token_dir" {
|
|
value = local.token_dir
|
|
}
|
|
|
|
output "skipped" {
|
|
value = var.skip
|
|
}
|