test(e2e): Add vault tests

Adds the first set of vault tests. This test sets up vault as a credential store and creates a set
of credentials for a target.
This commit is contained in:
Michael Li committed 2022-09-27 12:21:10 -04:00
1 parent 6e53747b97
commit 8fe0d13caa
13 files changed
+922 -92

No files matched your search

+18 -1
View File
@@ -30,6 +30,10 @@ variable "local_boundary_dir" {
description = "Local Path to boundary executable"
type = string
}
variable "target_user" {
description = "SSH username for target"
type = string
}
variable "aws_ssh_private_key_path" {
description = "Local Path to key used to SSH onto created hosts"
type = string
@@ -38,9 +42,20 @@ variable "target_ips" {
description = "List of IP Addresses of created hosts"
type = list(string)
}
variable "vault_addr" {
description = "URL of Vault instance"
type = string
default = ""
}
variable "vault_root_token" {
description = "Root token for vault instance"
type = string
default = ""
}
locals {
aws_ssh_private_key_path = abspath(var.aws_ssh_private_key_path)
vault_addr = var.vault_addr != "" ? "http://${var.vault_addr}:8200" : ""
}
resource "enos_local_exec" "run_e2e_test" {
@@ -50,8 +65,10 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_PASSWORD_ADMIN_LOGIN_NAME = var.auth_login_name,
E2E_PASSWORD_ADMIN_PASSWORD = var.auth_password,
E2E_TARGET_IP = var.target_ips[0],
E2E_SSH_USER = "ubuntu"
E2E_SSH_USER = var.target_user,
E2E_SSH_KEY_PATH = local.aws_ssh_private_key_path,
VAULT_ADDR = local.vault_addr,
VAULT_TOKEN = var.vault_root_token
}
inline = ["PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package}"]