test(e2e): Differentiate between public and private vault addresses (#5553)

This commit is contained in:
Michael Li authored and GitHub committed 2025-02-20 10:27:43 -05:00
1 parent 99f4bc092f
commit 14808d197f
15 files changed
+56 -49

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ output "instance_private_ips" {
output "instance_addresses" {
description = "Addresses of Vault instances"
value = [for instance in aws_instance.vault_instance : "http://${instance.public_ip}:8200"]
value = var.ip_version == "4" ? [for instance in aws_instance.vault_instance : "http://${instance.public_ip}:8200"] : flatten([for instance in aws_instance.vault_instance : instance.ipv6_addresses])
}
output "instance_addresses_private" {
description = "Private addresses of Vault instances"
value = [for instance in aws_instance.vault_instance : "http://${instance.private_ip}:8200"]
}
output "key_id" {
+2 -2
View File
@@ -132,11 +132,11 @@ resource "enos_local_exec" "check_health" {
inline = ["timeout 10s bash -c 'until vault status; do sleep 2; done'"]
}
output "address" {
output "address_public" {
value = "http://${var.container_name}:${var.vault_port}"
}
output "address_internal" {
output "address_private" {
value = "http://${var.container_name}:${var.vault_port_internal}"
}
+8 -13
View File
@@ -66,13 +66,14 @@ variable "target_port" {
type = string
default = ""
}
variable "vault_addr" {
description = "External network address of Vault. Will be converted to a URL below"
variable "vault_addr_public" {
description = "Public address to a vault instance"
type = string
default = ""
}
variable "vault_addr_internal" {
description = "Internal network address of Vault (i.e. within a docker network). Will be converted to a URL below"
variable "vault_addr_private" {
description = "Private address to a vault instance"
type = string
default = ""
}
@@ -81,11 +82,6 @@ variable "vault_root_token" {
type = string
default = ""
}
variable "vault_port" {
description = "External Port that vault instance is attached to (outside of docker network)"
type = string
default = "8200"
}
variable "aws_access_key_id" {
description = "Access Key Id for AWS IAM user used in dynamic host catalogs"
type = string
@@ -174,8 +170,6 @@ variable "ip_version" {
locals {
aws_ssh_private_key_path = abspath(var.aws_ssh_private_key_path)
vault_addr = var.vault_addr != "" ? "http://${var.vault_addr}:${var.vault_port}" : ""
vault_addr_internal = var.vault_addr_internal != "" ? "http://${var.vault_addr_internal}:8200" : local.vault_addr
aws_host_set_ips1 = jsonencode(var.aws_host_set_ips1)
aws_host_set_ips2 = jsonencode(var.aws_host_set_ips2)
package_name = reverse(split("/", var.test_package))[0]
@@ -194,9 +188,10 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_SSH_USER = var.target_user
E2E_SSH_KEY_PATH = local.aws_ssh_private_key_path
E2E_SSH_CA_KEY = ""
VAULT_ADDR = local.vault_addr
VAULT_ADDR = var.vault_addr_public
VAULT_TOKEN = var.vault_root_token
E2E_VAULT_ADDR = local.vault_addr_internal
E2E_VAULT_ADDR_PUBLIC = var.vault_addr_public
E2E_VAULT_ADDR_PRIVATE = var.vault_addr_private
E2E_AWS_ACCESS_KEY_ID = var.aws_access_key_id
E2E_AWS_SECRET_ACCESS_KEY = var.aws_secret_access_key
E2E_AWS_HOST_SET_FILTER = var.aws_host_set_filter1
+9 -7
View File
@@ -94,13 +94,14 @@ variable "target_ca_key" {
type = string
default = ""
}
variable "vault_addr" {
description = "External network address of Vault. Will be converted to a URL below"
variable "vault_addr_public" {
description = "Public address to a vault instance"
type = string
default = ""
}
variable "vault_addr_internal" {
description = "Internal network address of Vault (i.e. within a docker network). Will be converted to a URL below"
variable "vault_addr_private" {
description = "Private address to a vault instance"
type = string
default = ""
}
@@ -314,10 +315,11 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_SSH_USER = var.target_user
E2E_SSH_KEY_PATH = local.aws_ssh_private_key_path
E2E_SSH_CA_KEY = var.target_ca_key
VAULT_ADDR = var.vault_addr
VAULT_ADDR_INTERNAL = var.vault_addr_internal
VAULT_ADDR = var.vault_addr_public
VAULT_ADDR_INTERNAL = var.vault_addr_private
VAULT_TOKEN = var.vault_root_token
E2E_VAULT_ADDR = var.vault_addr_internal
E2E_VAULT_ADDR_PUBLIC = var.vault_addr_public
E2E_VAULT_ADDR_PRIVATE = var.vault_addr_private
E2E_BUCKET_NAME = var.bucket_name
E2E_BUCKET_ENDPOINT_URL = var.bucket_endpoint_url
E2E_BUCKET_USER_ID = var.bucket_user_id
+2 -1
View File
@@ -31,7 +31,8 @@ docker run \
-e "E2E_MINIO_ALIAS=$E2E_MINIO_ALIAS" \
-e "VAULT_ADDR=$VAULT_ADDR_INTERNAL" \
-e "VAULT_TOKEN=$VAULT_TOKEN" \
-e "E2E_VAULT_ADDR=$E2E_VAULT_ADDR" \
-e "E2E_VAULT_ADDR_PUBLIC=$E2E_VAULT_ADDR_PUBLIC" \
-e "E2E_VAULT_ADDR_PRIVATE=$E2E_VAULT_ADDR_PRIVATE" \
-e "E2E_POSTGRES_USER=$E2E_POSTGRES_USER" \
-e "E2E_POSTGRES_PASSWORD=$E2E_POSTGRES_PASSWORD" \
-e "E2E_POSTGRES_DB_NAME=$E2E_POSTGRES_DB_NAME" \
+8 -6
View File
@@ -73,13 +73,14 @@ variable "target_ca_key_public" {
type = string
default = ""
}
variable "vault_addr" {
description = "External network address of Vault. Will be converted to a URL below"
variable "vault_addr_public" {
description = "Public address to a vault instance"
type = string
default = ""
}
variable "vault_addr_internal" {
description = "Internal network address of Vault (i.e. within a docker network). Will be converted to a URL below"
variable "vault_addr_private" {
description = "Private address to a vault instance"
type = string
default = ""
}
@@ -211,9 +212,10 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_SSH_KEY_PATH = local.aws_ssh_private_key_path
E2E_SSH_CA_KEY = var.target_ca_key
E2E_SSH_CA_KEY_PUBLIC = var.target_ca_key_public
VAULT_ADDR = var.vault_addr
VAULT_ADDR = var.vault_addr_public
VAULT_TOKEN = var.vault_root_token
E2E_VAULT_ADDR = var.vault_addr_internal
E2E_VAULT_ADDR_PUBLIC = var.vault_addr_public
E2E_VAULT_ADDR_PRIVATE = var.vault_addr_private
E2E_AWS_ACCESS_KEY_ID = var.aws_access_key_id
E2E_AWS_SECRET_ACCESS_KEY = var.aws_secret_access_key
E2E_AWS_HOST_SET_FILTER = var.aws_host_set_filter