diff --git a/enos/enos-scenario-e2e-aws-rdp-base.hcl b/enos/enos-scenario-e2e-aws-rdp-base.hcl index 9a31be0ba9..b802edb1b5 100644 --- a/enos/enos-scenario-e2e-aws-rdp-base.hcl +++ b/enos/enos-scenario-e2e-aws-rdp-base.hcl @@ -115,6 +115,7 @@ scenario "e2e_aws_rdp_base" { boundary_src_path = local.local_boundary_src_dir github_token = var.github_token ip_version = local.ip_version + vault_version = var.vault_version } } @@ -321,10 +322,10 @@ scenario "e2e_aws_rdp_base" { client_password = step.create_windows_client.test_password client_test_dir = step.create_windows_client.test_dir client_ssh_key = step.create_windows_client.ssh_private_key - vault_addr_public = step.create_vault_cluster.instance_public_ips_ipv4[0] - vault_addr_private = step.create_vault_cluster.instance_private_ips[0] - vault_root_token = step.create_vault_cluster.vault_root_token client_version = matrix.client + vault_addr_public = step.create_vault_cluster.instance_addresses[0] + vault_addr_private = step.create_vault_cluster.instance_addresses_private[0] + vault_root_token = step.create_vault_cluster.vault_root_token } } diff --git a/enos/modules/aws_windows_client/main.tf b/enos/modules/aws_windows_client/main.tf index df247f978d..47ede6016d 100644 --- a/enos/modules/aws_windows_client/main.tf +++ b/enos/modules/aws_windows_client/main.tf @@ -350,6 +350,7 @@ resource "local_file" "powershell_script" { boundary_src_zip_path = "${local.test_dir}/${basename(archive_file.boundary_src_zip[0].output_path)}" go_version = "${enos_local_exec.get_go_version.stdout}" github_token = "${var.github_token}" + vault_version = "${var.vault_version}" }) filename = "${path.root}/.terraform/tmp/setup_windows_client.ps1" } diff --git a/enos/modules/aws_windows_client/scripts/setup.ps1 b/enos/modules/aws_windows_client/scripts/setup.ps1 index ec8d9a3a67..fa60d78d75 100644 --- a/enos/modules/aws_windows_client/scripts/setup.ps1 +++ b/enos/modules/aws_windows_client/scripts/setup.ps1 @@ -23,6 +23,17 @@ $newPath = $existingPath + ";" + $destination [EnvironmentVariableTarget]::Machine ) +Write-Host "Checking if Vault needs to be installed..." +if ("${vault_version}" -ne "") { + Write-Host "Installing Vault version ${vault_version}..." + # Download and install Vault + $vaultZipUrl = "https://releases.hashicorp.com/vault/${vault_version}/vault_${vault_version}_windows_amd64.zip" + $vaultZipPath = Join-Path $destination "vault.zip" + curl.exe -L -o $vaultZipPath $vaultZipUrl + + Expand-Archive -Path $vaultZipPath -DestinationPath $destination -Force +} + # Install chocolatey (package manager) powershell -c "irm https://community.chocolatey.org/install.ps1|iex" diff --git a/enos/modules/aws_windows_client/variables.tf b/enos/modules/aws_windows_client/variables.tf index 31c890148e..8b3e556088 100644 --- a/enos/modules/aws_windows_client/variables.tf +++ b/enos/modules/aws_windows_client/variables.tf @@ -59,3 +59,9 @@ variable "github_token" { type = string default = "" } + +variable "vault_version" { + description = "Version of Vault to install on client" + type = string + default = "" +}