Nodes are created across the given subnets.

This commit is contained in:
2021-12-23 13:06:45 -05:00
parent 861641dbd8
commit 97f358332c
7 changed files with 48 additions and 11 deletions
+8
View File
@@ -22,6 +22,14 @@ data "aws_subnet" "subnets" {
id = each.key
}
data "aws_subnet" "subnet-by-name" {
for_each = toset(var.existing-subnet-names)
filter {
name = "tag:Name"
values = [each.key]
}
}
data "aws_security_group" "default" {
name = var.default-security-group-name
}
+7 -2
View File
@@ -11,11 +11,16 @@ output "subnets" {
value = data.aws_subnet.subnets
}
output "k8s-subnets-ids" {
description = "An array of subnets to be used for k8s VMs. These subnets were chosen by selecting a single subnet from each availability_zone."
output "one-subnet-per-az" {
description = "An array of subnets that selects 1 subnet per az."
value = [for k,v in local.az-to-subnets : v[0]]
}
output "subnet-by-name" {
description = "A map of subnet name to subnet resource."
value = data.aws_subnet.subnet-by-name
}
output "az-to-subnets" {
description = "A map of availability zone to array of subnets that are in thet availability zone."
value = local.az-to-subnets
@@ -5,3 +5,9 @@ variable "default-security-group-name" {
variable "default-vpc-name" {
description = "The name of the existing default VPC. This module will query AWS for a VPC with this name,"
}
variable "existing-subnet-names" {
description = "A list of subnet names that already exist in default-vpc-name"
default = []
type = list(string)
}