Forgot to add aws-nodes files.

- Moved network_config.cfg to libvirt-nodes.
new-vpc
Curtis Wilson 4 years ago
parent 097a150b57
commit 4791bf9b6d

8
.gitignore vendored

@ -38,3 +38,11 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc
################################################################################
# end Pulled from github/gitignore 2021-11-10 commit 1a84870
################################################################################
k8s-key*
STARTHERE

@ -0,0 +1,14 @@
resource "aws_instance" "nodes" {
ami = var.ami
instance_type = var.ec2-instance-type
# key_name = aws_key_pair.debug1.key_name
associate_public_ip_address = true
subnet_id = var.subnet-id
vpc_security_group_ids = var.security-group-ids
user_data = element(var.user-datas.*.rendered, count.index)
count = var.num-nodes
tags = {
Name = "${var.name-prefix}-${count.index}"
}
}

@ -0,0 +1,3 @@
output "ips" {
value = aws_instance.nodes.*.public_ip
}

@ -0,0 +1,36 @@
variable "ami" {
description = "The AWS AMI to be used for all the nodes"
type = string
}
variable "ec2-instance-type" {
default = "t2.micro"
description = "The AWS instance type to use for all nodes."
type = string
}
variable "name-prefix" {
default = "tf-node"
description = "This prefix will be applied to all names created by this module."
type = string
}
variable "num-nodes" {
default = 1
description = "The number of nodes to create from the given input parameters."
type = number
}
variable "user-datas" {
description = "A list of cloud-init configs that get applied to their corresponding node."
}
variable "subnet-id" {
description = "The ID of the subnet that all the nodes will be added to."
type = string
}
variable "security-group-ids" {
description = "A list of security group IDs to be applied to all the nodes."
type = list(string)
}
Loading…
Cancel
Save