test(e2e): Add an enos module for docker-based workers (#3603)
* test(e2e): Add an enos module for a worker in docker * fixup! test(e2e): Add an enos module for a worker in docker
This commit is contained in:
1 parent
06a37f605a
commit
9687535ab0
16 files changed
+545
-38
No files matched your search
@@ -0,0 +1,60 @@
|
||||
# Copyright (c) HashiCorp, Inc.
|
||||
# SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
disable_mlock = true
|
||||
|
||||
controller {
|
||||
name = "docker-controller"
|
||||
|
||||
database {
|
||||
url = "env://BOUNDARY_POSTGRES_URL"
|
||||
}
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "boundary:9200"
|
||||
purpose = "api"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "boundary:9201"
|
||||
purpose = "cluster"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "boundary:9203"
|
||||
purpose = "ops"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
kms "aead" {
|
||||
purpose = "root"
|
||||
aead_type = "aes-gcm"
|
||||
key = "sP1fnF5Xz85RrXyELHFeZg9Ad2qt4Z4bgNHVGtD6ung="
|
||||
key_id = "global_root"
|
||||
}
|
||||
|
||||
# This key_id needs to match the corresponding downstream worker's
|
||||
# "worker-auth" kms
|
||||
kms "aead" {
|
||||
purpose = "worker-auth"
|
||||
aead_type = "aes-gcm"
|
||||
key = "OLFhJNbEb3umRjdhY15QKNEmNXokY1Iq"
|
||||
key_id = "global_worker-auth"
|
||||
}
|
||||
|
||||
kms "aead" {
|
||||
purpose = "recovery"
|
||||
aead_type = "aes-gcm"
|
||||
key = "8fZBjCUfN0TzjEGLQldGY4+iE9AkOvCfjh7+p0GtRBQ="
|
||||
key_id = "global_recovery"
|
||||
}
|
||||
|
||||
kms "aead" {
|
||||
purpose = "bsr"
|
||||
aead_type = "aes-gcm"
|
||||
key = "8fZBjCUfN0TzjEGLQldGY4+iE9AkOvCfjh7+p0GtRBQ="
|
||||
key_id = "bsr_key"
|
||||
}
|
||||
@@ -48,10 +48,12 @@ kms "aead" {
|
||||
key_id = "global_root"
|
||||
}
|
||||
|
||||
# This key_id needs to match the corresponding downstream worker's
|
||||
# "worker-auth" kms
|
||||
kms "aead" {
|
||||
purpose = "worker-auth"
|
||||
aead_type = "aes-gcm"
|
||||
key = "8fZBjCUfN0TzjEGLQldGY4+iE9AkOvCfjh7+p0GtRBQ="
|
||||
key = "OLFhJNbEb3umRjdhY15QKNEmNXokY1Iq"
|
||||
key_id = "global_worker-auth"
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ docker run \
|
||||
-e "BOUNDARY_LICENSE=$TEST_BOUNDARY_LICENSE" \
|
||||
-e "SKIP_CHOWN=true" \
|
||||
--cap-add IPC_LOCK \
|
||||
--mount type=bind,src=$SOURCE,dst=/boundary/ \
|
||||
--network $TEST_NETWORK_NAME \
|
||||
-v "$CONFIG:/boundary/boundary-config.hcl" \
|
||||
--network $TEST_DATABASE_NETWORK \
|
||||
$TEST_BOUNDARY_IMAGE \
|
||||
boundary database init -config /boundary/boundary-config.hcl -format json
|
||||
@@ -24,7 +24,11 @@ variable "image_name" {
|
||||
type = string
|
||||
}
|
||||
variable "network_name" {
|
||||
description = "Name of Docker Network"
|
||||
description = "Name of Docker Networks to join"
|
||||
type = list(string)
|
||||
}
|
||||
variable "database_network" {
|
||||
description = "Name of Docker Network that database lives in"
|
||||
type = string
|
||||
}
|
||||
variable "container_name" {
|
||||
@@ -40,19 +44,24 @@ variable "boundary_license" {
|
||||
description = "License string"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "config_file" {
|
||||
description = "Path to config file"
|
||||
type = string
|
||||
default = "boundary-config.hcl"
|
||||
}
|
||||
|
||||
resource "docker_image" "boundary" {
|
||||
name = var.image_name
|
||||
keep_locally = true
|
||||
keep_locally = false
|
||||
}
|
||||
|
||||
resource "enos_local_exec" "init_database" {
|
||||
environment = {
|
||||
TEST_BOUNDARY_IMAGE = var.image_name,
|
||||
TEST_DATABASE_ADDRESS = var.postgres_address,
|
||||
TEST_NETWORK_NAME = var.network_name
|
||||
TEST_BOUNDARY_IMAGE = var.image_name
|
||||
TEST_DATABASE_ADDRESS = var.postgres_address
|
||||
TEST_DATABASE_NETWORK = var.database_network
|
||||
TEST_BOUNDARY_LICENSE = var.boundary_license
|
||||
CONFIG = "${abspath(path.module)}/${var.config_file}"
|
||||
}
|
||||
inline = ["bash ./${path.module}/init.sh"]
|
||||
}
|
||||
@@ -62,6 +71,7 @@ locals {
|
||||
auth_method_id = local.db_init_info["auth_method"]["auth_method_id"]
|
||||
login_name = local.db_init_info["auth_method"]["login_name"]
|
||||
password = local.db_init_info["auth_method"]["password"]
|
||||
address = "http://${var.container_name}:9200"
|
||||
}
|
||||
|
||||
resource "docker_container" "boundary" {
|
||||
@@ -96,9 +106,11 @@ resource "docker_container" "boundary" {
|
||||
capabilities {
|
||||
add = ["IPC_LOCK"]
|
||||
}
|
||||
volumes {
|
||||
host_path = abspath(path.module)
|
||||
container_path = "/boundary/"
|
||||
|
||||
upload {
|
||||
content = templatefile("${abspath(path.module)}/${var.config_file}", {
|
||||
})
|
||||
file = "/boundary/boundary-config.hcl"
|
||||
}
|
||||
healthcheck {
|
||||
test = ["CMD", "wget", "--quiet", "-O", "/dev/null", "http://boundary:9203/health"]
|
||||
@@ -108,8 +120,11 @@ resource "docker_container" "boundary" {
|
||||
}
|
||||
wait = true
|
||||
must_run = true
|
||||
networks_advanced {
|
||||
name = var.network_name
|
||||
dynamic "networks_advanced" {
|
||||
for_each = var.network_name
|
||||
content {
|
||||
name = networks_advanced.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +145,11 @@ resource "enos_local_exec" "check_health" {
|
||||
}
|
||||
|
||||
output "address" {
|
||||
value = "http://${var.container_name}:9200"
|
||||
value = local.address
|
||||
}
|
||||
|
||||
output "upstream_address" {
|
||||
value = "${var.container_name}:9201"
|
||||
}
|
||||
|
||||
output "auth_method_id" {
|
||||
|
||||
Reference in new issue
Block a user