From 4ad647e3eed4d937d2747e01a7b922cbf92759e3 Mon Sep 17 00:00:00 2001 From: gene-redpanda <123959009+gene-redpanda@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:43:50 -0600 Subject: [PATCH] add support for passing in az/subnet in the example --- aws/main.tf | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/aws/main.tf b/aws/main.tf index c949812..7b945ad 100644 --- a/aws/main.tf +++ b/aws/main.tf @@ -1,21 +1,26 @@ ## we assume a default vpc. if you have one you want to use you will need to provide a vpc and subnet ID module "redpanda-cluster" { - source = "redpanda-data/redpanda-cluster/aws" - version = "~> 1.0.2" - public_key_path = var.public_key_path - broker_count = var.broker_count - deployment_prefix = var.deployment_prefix - enable_monitoring = var.enable_monitoring - tiered_storage_enabled = var.tiered_storage_enabled - allow_force_destroy = var.allow_force_destroy - vpc_id = var.vpc_id - distro = var.distro - hosts_file = var.hosts_file + source = "redpanda-data/redpanda-cluster/aws" + version = "~> 1.0.2" + public_key_path = var.public_key_path + broker_count = var.broker_count + deployment_prefix = var.deployment_prefix + enable_monitoring = var.enable_monitoring + tiered_storage_enabled = var.tiered_storage_enabled + allow_force_destroy = var.allow_force_destroy + vpc_id = var.vpc_id + distro = var.distro + hosts_file = var.hosts_file + subnets = { + "broker" : { + "${var.availability_zone}" : var.subnet_id + } + } tags = var.tags aws_region = var.aws_region associate_public_ip_addr = var.associate_public_ip_addr - availability_zone = var.availability_zone + availability_zone = [var.availability_zone] client_count = 1 broker_instance_type = var.instance_type client_instance_type = var.instance_type @@ -24,8 +29,8 @@ module "redpanda-cluster" { } variable "availability_zone" { - default = ["us-west-2a"] - type = list(string) + default = "us-west-2a" + type = string } variable "associate_public_ip_addr" { @@ -123,3 +128,8 @@ variable "machine_architecture" { type = string default = "x86_64" } + +variable "subnet_id" { + type = string + default = "" +} \ No newline at end of file