refact(e2e): Set up variables to prepare for docker implementation (#2992)

* refact(e2e): Explicitly define port used for targets

To maintain consistency for how we define ports, this change explicitly defines the port used in the enos
scenario as opposed to relying on a "default" value. This change is in support of work that attempts to
spin up test infrastructure using docker. The openssh-server image uses Port 2222, which needs to be
passed to the test suite.

* refact(e2e): Add optional "Internal" Vault Address parameter

This change enables scenarios that need two different Vault addresses, one used by the Vault CLI and
one by the Boundary server instance. In the case when using a Docker container, the Boundary server
needs the Vault address "internal" to the Docker network, whereas the Vault CLI running outside of the
network needs a different address.
This commit is contained in:
Michael Li authored and GitHub committed 2023-02-23 12:05:06 -05:00
1 parent 7733677e34
commit 5ec75924df
14 files changed
+36 -21

No files matched your search

+14 -1
View File
@@ -52,8 +52,18 @@ variable "target_ip" {
type = string
default = ""
}
variable "target_port" {
description = "Port of target"
type = string
default = ""
}
variable "vault_addr" {
description = "URL of Vault instance"
description = "External network address of Vault. Will be converted to a URL below"
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"
type = string
default = ""
}
@@ -101,6 +111,7 @@ variable "aws_host_set_ips2" {
locals {
aws_ssh_private_key_path = abspath(var.aws_ssh_private_key_path)
vault_addr = var.vault_addr != "" ? "http://${var.vault_addr}:8200" : ""
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]
@@ -115,9 +126,11 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_PASSWORD_ADMIN_PASSWORD = var.auth_password,
E2E_TARGET_IP = var.target_ip,
E2E_SSH_USER = var.target_user,
E2E_SSH_PORT = var.target_port,
E2E_SSH_KEY_PATH = local.aws_ssh_private_key_path,
VAULT_ADDR = local.vault_addr,
VAULT_TOKEN = var.vault_root_token,
E2E_VAULT_ADDR = local.vault_addr_internal,
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,