Cleaned up some TODOs.

master
shnee 4 years ago
parent 4d39461101
commit 40613e08b6

@ -59,7 +59,9 @@ module "cloud-init-config" {
# }
module "aws-network-existing" {
source = "./modules/aws-network-existing"
source = "./modules/aws-network-existing"
default-vpc-name = var.aws-existing-vpc-name
default-security-group-name = var.aws-existing-sg-name
}
################################################################################
@ -79,8 +81,8 @@ module "nodes" {
source = "./modules/aws-nodes"
ami = each.value.base-image
ec2-instance-type = var.aws-ec2-instance-type
subnet-id = module.aws-network-existing.k8s-subnets[0]
security-group-ids = [data.aws_security_group.default.id]
subnet-id = module.aws-network-existing.k8s-subnets-ids[0]
security-group-ids = [module.aws-network-existing.default-sg.id]
user-datas = lookup(module.cloud-init-config, each.key, null).user-datas
num-nodes = each.value.num
name-prefix = "${var.vm-name-prefix}-${each.key}"

@ -21,3 +21,7 @@ data "aws_subnet" "subnets" {
for_each = toset(data.aws_subnets.subnet-ids.ids)
id = each.key
}
data "aws_security_group" "default" {
name = var.default-security-group-name
}

@ -2,12 +2,16 @@ output "default-vpc" {
value = data.aws_vpc.default
}
output "default-sg" {
value = data.aws_security_group.default
}
output "subnets" {
description = "An array of all subnets in default-vpc."
value = data.aws_subnet.subnets
}
output "k8s-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."
value = [for k,v in local.az-to-subnets : v[0]]
}

@ -1,4 +1,7 @@
variable "default-security-group-name" {
description = "The name of the existing default security group. This module will query AWS for a security group with this name,"
}
variable "default-vpc-name" {
description = "The name of the existing default VPC. This module will query AWS for a VPC with this name,"
default = "Managed VPC"
}

@ -1,8 +1,6 @@
resource "aws_instance" "nodes" {
ami = var.ami
instance_type = var.ec2-instance-type
# TODO REM double check this key.
# key_name = aws_key_pair.debug1.key_name
# TODO Make this a variable.
associate_public_ip_address = true
subnet_id = var.subnet-id

@ -9,6 +9,16 @@ variable "aws-ec2-instance-type" {
description = "The AWS instance type to use for all nodes."
}
variable "aws-existing-sg-name" {
default = "change-me-if-using-aws-network-existing"
description = "The name of the existing security group when using aws-network-existing."
}
variable "aws-existing-vpc-name" {
default = "change-me-if-using-aws-network-existing"
description = "The name of the existing VPC when using aws-network-existing."
}
variable "aws-region" {
default = "us-east-1"
description = "The AWS region to use."

Loading…
Cancel
Save