Nodes are created across the given subnets.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user