mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-27 18:10:26 -04:00
Add support for running enos on Fyre with support for linux/s390x,
linux/amd64, and linux/ppc64le. The enterprise version of this PR
has enterprise only scenarios. The changes reflected here are on
shared modules.
We now have three new fyre modules that are can swap in-place of
create_vpc, ec2_info, and target_ec2_instances:
create_vpc_fyre_shim, fyre_os_info and target_fyre_vms. This pass
doesn't make them adhered 1:1 as module interfaces but that can come
later when the base scenarios are merged.
The only major change we had to make to long existing modules was
supporting leader_api_addr for discovery. Historically we've always used
cloud based node discovery but that's obviously not available in Fyre.
Nowyou can set the retry_join variable to either local_api_addr or
aws.
We also modify our integration containers to use those available from
the HashiCorp docker mirror. We do this because we pull those images
unauthenticated and thus share the same external address as the larger
network, which makes the likelihood of throttling very high.
To maintain the goal of the Fyre scenarios not requiring AWS credentials, I
had to move the AWS secrets verification into it's own module. That allows
us now to simply not include it, but later if/when we include it we can have
scenarios with the Fyre backend compile them out by skipping.
This PR is massive and covers the following tickets:
VAULT-40635
VAULT-40636
VAULT-44591
VAULT-34888
VAULT-34887
VAULT-34886
VAULT-34885
VAULT-34884
Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
153 lines
4.5 KiB
HCL
Executable file
153 lines
4.5 KiB
HCL
Executable file
# Copyright IBM Corp. 2016, 2025
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
terraform {
|
|
required_providers {
|
|
enos = {
|
|
source = "registry.terraform.io/hashicorp-forge/enos"
|
|
}
|
|
}
|
|
}
|
|
|
|
locals {
|
|
test_server_address = var.ip_version == "6" ? var.hosts[0].ipv6 : var.hosts[0].public_ip
|
|
ldap_base_dn = join(",", formatlist("dc=%s", split(".", var.ldap_domain)))
|
|
ldap_server = {
|
|
domain = var.ldap_domain
|
|
base_dn = local.ldap_base_dn
|
|
org = "hashicorp"
|
|
admin_pw = "password1"
|
|
version = var.ldap_version
|
|
port = var.ports.ldap.port
|
|
secure_port = var.ports.ldaps.port
|
|
ip_version = var.ip_version
|
|
host = var.hosts[0]
|
|
}
|
|
kmip_client = {
|
|
// The KMIP client configuration is used to connect to the KMIP server
|
|
// uses Percona (MySQL) as the KMIP client.
|
|
port = var.ports.mysql.port
|
|
host = var.hosts[0]
|
|
}
|
|
# Database configurations are now pulled from var.database_configs
|
|
database_servers = {
|
|
for db_name, db_config in var.database_configs : db_name => merge(db_config, {
|
|
host = var.hosts[0]
|
|
})
|
|
}
|
|
}
|
|
|
|
# Outputs
|
|
output "state" {
|
|
value = merge(
|
|
{
|
|
ldap = local.ldap_server
|
|
kmip = local.kmip_client
|
|
},
|
|
# Add database servers dynamically
|
|
{ for db_name, db_server in local.database_servers : db_name => db_server }
|
|
)
|
|
}
|
|
|
|
# We run install_packages before we install Vault because for some combinations of
|
|
# certain Linux distros and artifact types (e.g. SLES and RPM packages), there may
|
|
# be packages that are required to perform Vault installation (e.g. openssl).
|
|
module "install_packages" {
|
|
source = "../install_packages"
|
|
hosts = var.hosts
|
|
packages = var.packages
|
|
}
|
|
|
|
# Creating OpenLDAP Server using generic container script
|
|
resource "enos_remote_exec" "setup_openldap" {
|
|
depends_on = [module.install_packages]
|
|
|
|
scripts = [abspath("${path.module}/scripts/start-container.sh")]
|
|
|
|
environment = {
|
|
CONTAINER_IMAGE = "docker.mirror.hashicorp.services/osixia/openldap:${local.ldap_server.version}"
|
|
CONTAINER_NAME = "openldap"
|
|
CONTAINER_PORTS = "${local.ldap_server.port},${local.ldap_server.secure_port}"
|
|
CONTAINER_ENVS = "LDAP_ORGANISATION=${local.ldap_server.org},LDAP_DOMAIN=${local.ldap_server.domain},LDAP_ADMIN_PASSWORD=${local.ldap_server.admin_pw}"
|
|
}
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = local.ldap_server.host.public_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
// Wait for the base DN to be available before we populate it
|
|
module "wait_for_ldap_base_dn" {
|
|
depends_on = [enos_remote_exec.setup_openldap]
|
|
source = "../ldap_wait_for_search"
|
|
|
|
hosts = var.hosts
|
|
ldap_base_dn = local.ldap_base_dn
|
|
ldap_bind_dn = "cn=admin,${local.ldap_base_dn}"
|
|
ldap_host = local.ldap_server.host
|
|
ldap_password = local.ldap_server.admin_pw
|
|
ldap_port = local.ldap_server.port
|
|
}
|
|
|
|
# Populate LDAP server with required users and organizational units
|
|
resource "enos_remote_exec" "populate_ldap" {
|
|
depends_on = [module.wait_for_ldap_base_dn]
|
|
|
|
scripts = [abspath("${path.module}/scripts/populate-ldap.sh")]
|
|
|
|
environment = {
|
|
LDAP_SERVER = local.ldap_server.host.private_ip
|
|
LDAP_PORT = local.ldap_server.port
|
|
LDAP_ADMIN_PW = local.ldap_server.admin_pw
|
|
LDAP_BASE_DN = local.ldap_server.base_dn
|
|
}
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = local.ldap_server.host.public_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
# Creating KMIP Server using generic container script
|
|
resource "enos_remote_exec" "create_kmip" {
|
|
depends_on = [module.install_packages]
|
|
|
|
inline = [
|
|
"mkdir -p /tmp/kmip_temp"
|
|
]
|
|
|
|
scripts = [abspath("${path.module}/scripts/start-container.sh")]
|
|
|
|
environment = {
|
|
CONTAINER_IMAGE = "docker.mirror.hashicorp.services/library/mysql:8.0"
|
|
CONTAINER_NAME = "kmip"
|
|
CONTAINER_VOLUMES = "/tmp/kmip_temp:/TEMP_DIR"
|
|
CONTAINER_ENVS = "KMIP_ADDR=${local.test_server_address},MYSQL_ROOT_PASSWORD=testpassword"
|
|
CONTAINER_ARGS = "--port ${var.ports.kmip.port}"
|
|
}
|
|
|
|
transport = {
|
|
ssh = {
|
|
host = local.kmip_client.host.public_ip
|
|
}
|
|
}
|
|
}
|
|
|
|
# Creating Database Servers using generic database_container module
|
|
module "database_servers" {
|
|
for_each = var.database_configs
|
|
source = "../database_container"
|
|
|
|
database_type = each.key
|
|
db_version = each.value.version
|
|
username = each.value.username
|
|
password = each.value.password
|
|
database = each.value.database
|
|
port = each.value.port
|
|
host = var.hosts[0]
|
|
instance_name = "default"
|
|
depends_on_modules = [module.install_packages]
|
|
}
|