Skip to content

Commit

Permalink
chore(enos): Move terraform-enos-aws-boundary to boundary (#3773)
Browse files Browse the repository at this point in the history
* chore(enos): Move `terraform-enos-aws-boundary` to `boundary`

* chore(enos): Rename module tag

* chore(enos): Refactor module names

* fixup! chore(enos): Move `terraform-enos-aws-boundary` to `boundary`

* fixup! chore(enos): Move `terraform-enos-aws-boundary` to `boundary`

* chore(enos): Refactored hard-coded module tag
  • Loading branch information
moduli authored Oct 10, 2023
1 parent 9acff95 commit 9c9e033
Show file tree
Hide file tree
Showing 31 changed files with 1,304 additions and 35 deletions.
25 changes: 12 additions & 13 deletions enos/enos-modules.hcl
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

module "az_finder" {
source = "./modules/az_finder"
module "aws_az_finder" {
source = "./modules/aws_az_finder"
}

module "bats_deps" {
source = "./modules/bats_deps"
}

module "boundary" {
source = "app.terraform.io/hashicorp-qti/aws-boundary/enos"
version = ">= 0.6.2"
module "aws_boundary" {
source = "./modules/aws_boundary"

project_name = "qti-enos-boundary"
environment = var.environment
Expand All @@ -27,8 +26,8 @@ module "boundary" {
ssh_aws_keypair = var.aws_ssh_keypair_name
}

module "worker" {
source = "./modules/worker"
module "aws_worker" {
source = "./modules/aws_worker"

common_tags = {
"Project" : "Enos",
Expand All @@ -40,8 +39,8 @@ module "worker" {
ssh_aws_keypair = var.aws_ssh_keypair_name
}

module "bucket" {
source = "./modules/bucket"
module "aws_bucket" {
source = "./modules/aws_bucket"
}

module "build_crt" {
Expand All @@ -67,8 +66,8 @@ module "generate_aws_host_tag_vars" {
source = "./modules/generate_aws_host_tag_vars"
}

module "iam_setup" {
source = "./modules/iam_setup"
module "aws_iam_setup" {
source = "./modules/aws_iam_setup"
}

module "aws_vpc" {
Expand All @@ -95,8 +94,8 @@ module "map2list" {
source = "./modules/map2list"
}

module "target" {
source = "./modules/target"
module "aws_target" {
source = "./modules/aws_target"
target_count = var.target_count

project_name = "qti-enos-boundary"
Expand Down
7 changes: 4 additions & 3 deletions enos/enos-scenario-e2e-aws-base-with-vault.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ scenario "e2e_aws_base_with_vault" {
}

step "find_azs" {
module = module.az_finder
module = module.aws_az_finder

variables {
instance_type = [
Expand Down Expand Up @@ -75,7 +75,7 @@ scenario "e2e_aws_base_with_vault" {
}

step "create_boundary_cluster" {
module = module.boundary
module = module.aws_boundary
depends_on = [
step.create_base_infra,
step.create_db_password,
Expand All @@ -94,6 +94,7 @@ scenario "e2e_aws_base_with_vault" {
local_artifact_path = step.build_boundary.artifact_path
ubuntu_ami_id = step.create_base_infra.ami_ids["ubuntu"]["amd64"]
vpc_id = step.create_base_infra.vpc_id
vpc_tag_module = step.create_base_infra.vpc_tag_module
worker_count = var.worker_count
worker_instance_type = var.worker_instance_type
}
Expand Down Expand Up @@ -122,7 +123,7 @@ scenario "e2e_aws_base_with_vault" {
}

step "create_target" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand Down
7 changes: 4 additions & 3 deletions enos/enos-scenario-e2e-aws-base.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ scenario "e2e_aws_base" {
}

step "find_azs" {
module = module.az_finder
module = module.aws_az_finder

variables {
instance_type = [
Expand Down Expand Up @@ -75,7 +75,7 @@ scenario "e2e_aws_base" {
}

step "create_boundary_cluster" {
module = module.boundary
module = module.aws_boundary
depends_on = [
step.create_base_infra,
step.create_db_password,
Expand All @@ -94,13 +94,14 @@ scenario "e2e_aws_base" {
local_artifact_path = step.build_boundary.artifact_path
ubuntu_ami_id = step.create_base_infra.ami_ids["ubuntu"]["amd64"]
vpc_id = step.create_base_infra.vpc_id
vpc_tag_module = step.create_base_infra.vpc_tag_module
worker_count = var.worker_count
worker_instance_type = var.worker_instance_type
}
}

step "create_target" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand Down
15 changes: 8 additions & 7 deletions enos/enos-scenario-e2e-aws.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ scenario "e2e_aws" {
}

step "find_azs" {
module = module.az_finder
module = module.aws_az_finder

variables {
instance_type = [
Expand Down Expand Up @@ -76,7 +76,7 @@ scenario "e2e_aws" {
}

step "create_boundary_cluster" {
module = module.boundary
module = module.aws_boundary
depends_on = [
step.create_base_infra,
step.create_db_password,
Expand All @@ -95,6 +95,7 @@ scenario "e2e_aws" {
local_artifact_path = step.build_boundary.artifact_path
ubuntu_ami_id = step.create_base_infra.ami_ids["ubuntu"]["amd64"]
vpc_id = step.create_base_infra.vpc_id
vpc_tag_module = step.create_base_infra.vpc_tag_module
worker_count = var.worker_count
worker_instance_type = var.worker_instance_type
}
Expand All @@ -115,7 +116,7 @@ scenario "e2e_aws" {
}

step "create_targets_with_tag1" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand Down Expand Up @@ -145,7 +146,7 @@ scenario "e2e_aws" {
}

step "create_targets_with_tag2" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand All @@ -168,7 +169,7 @@ scenario "e2e_aws" {
}

step "iam_setup" {
module = module.iam_setup
module = module.aws_iam_setup
depends_on = [
step.create_base_infra,
step.create_test_id
Expand All @@ -185,7 +186,7 @@ scenario "e2e_aws" {
}

step "create_isolated_worker" {
module = module.worker
module = module.aws_worker
depends_on = [step.create_boundary_cluster]
variables {
vpc_id = step.create_base_infra.vpc_id
Expand All @@ -205,7 +206,7 @@ scenario "e2e_aws" {
}

step "create_isolated_target" {
module = module.target
module = module.aws_target
depends_on = [
step.create_base_infra,
step.create_isolated_worker
Expand Down
6 changes: 3 additions & 3 deletions enos/enos-scenario-e2e-database.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ scenario "e2e_database" {
}

step "find_azs" {
module = module.az_finder
module = module.aws_az_finder

variables {
instance_type = [
Expand Down Expand Up @@ -75,7 +75,7 @@ scenario "e2e_database" {
}

step "create_targets_with_tag" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand All @@ -98,7 +98,7 @@ scenario "e2e_database" {
}

step "iam_setup" {
module = module.iam_setup
module = module.aws_iam_setup
depends_on = [
step.create_base_infra,
step.create_test_id
Expand Down
11 changes: 6 additions & 5 deletions enos/enos-scenario-e2e-ui.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ scenario "e2e_ui" {
}

step "find_azs" {
module = module.az_finder
module = module.aws_az_finder

variables {
instance_type = [
Expand Down Expand Up @@ -76,7 +76,7 @@ scenario "e2e_ui" {
}

step "create_boundary_cluster" {
module = module.boundary
module = module.aws_boundary
depends_on = [
step.create_base_infra,
step.create_db_password,
Expand All @@ -95,6 +95,7 @@ scenario "e2e_ui" {
local_artifact_path = step.build_boundary.artifact_path
ubuntu_ami_id = step.create_base_infra.ami_ids["ubuntu"]["amd64"]
vpc_id = step.create_base_infra.vpc_id
vpc_tag_module = step.create_base_infra.vpc_tag_module
worker_count = var.worker_count
worker_instance_type = var.worker_instance_type
}
Expand Down Expand Up @@ -137,7 +138,7 @@ scenario "e2e_ui" {
}

step "create_targets_with_tag1" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand Down Expand Up @@ -167,7 +168,7 @@ scenario "e2e_ui" {
}

step "create_targets_with_tag2" {
module = module.target
module = module.aws_target
depends_on = [step.create_base_infra]

variables {
Expand All @@ -190,7 +191,7 @@ scenario "e2e_ui" {
}

step "iam_setup" {
module = module.iam_setup
module = module.aws_iam_setup
depends_on = [
step.create_base_infra,
step.create_test_id
Expand Down
File renamed without changes.
52 changes: 52 additions & 0 deletions enos/modules/aws_boundary/alb.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

resource "aws_alb" "boundary_alb" {
name = "boundary-alb-${random_string.cluster_id.result}"
depends_on = [aws_instance.controller]
security_groups = [aws_security_group.boundary_alb_sg.id]
subnets = data.aws_subnets.infra.ids
tags = merge(local.common_tags,
{
Name = "boundary-alb-${random_string.cluster_id.result}"
}
)
}

resource "aws_alb_target_group" "boundary_tg" {
name = "boundary-tg-${random_string.cluster_id.result}"
port = var.listener_api_port
protocol = "HTTP"
vpc_id = var.vpc_id

health_check {
path = var.healthcheck_path
port = var.listener_ops_port
interval = 5
timeout = 2
healthy_threshold = 2
}
tags = merge(local.common_tags,
{
Name = "boundary-tg-${random_string.cluster_id.result}"
},
)
}

resource "aws_lb_target_group_attachment" "boundary" {
for_each = toset([for idx in range(var.controller_count) : tostring(idx)])

target_group_arn = aws_alb_target_group.boundary_tg.arn
target_id = aws_instance.controller[each.value].id
port = var.listener_api_port
}

resource "aws_alb_listener" "boundary" {
load_balancer_arn = aws_alb.boundary_alb.arn
port = var.alb_listener_api_port
protocol = "HTTP"
default_action {
target_group_arn = aws_alb_target_group.boundary_tg.arn
type = "forward"
}
}
Loading

0 comments on commit 9c9e033

Please sign in to comment.