60 Commits
Author SHA1 Message Date
shnee 9504e3737d Added proxy and ZFS drives. 2022-01-07 15:36:23 -05:00
shnee 33f267b163 Checking in to change environments. 2021-12-29 11:01:54 -05:00
shnee 97f358332c Nodes are created across the given subnets. 2021-12-23 13:06:45 -05:00
shnee 861641dbd8 Make node-config accept ec2 type per group. 2021-12-22 16:44:39 -05:00
shnee 9a01c09928 Fixed gitignore. 2021-12-15 14:11:05 -05:00
shnee cf0da0d659 Fixed missed merge conflict. 2021-12-15 14:09:39 -05:00
shnee a324e68287 Removed files that got miss in reorg. 2021-12-15 11:34:44 -05:00
shnee 043ee3b342 Rebasing. 2021-12-15 09:55:10 -05:00
shnee 40613e08b6 Cleaned up some TODOs. 2021-12-15 09:38:11 -05:00
shnee 4d39461101 k8s cluster deployed to AWS. 2021-12-15 08:53:37 -05:00
shnee 15edee3b60 Moved everything from k8s-nodes to the top-level. 2021-12-13 20:30:29 -05:00
shnee dff900e53a Shared state is working. Qeurying for default VPC. 2021-12-13 20:27:35 -05:00
shnee 5107ec9a5c Branches k8s-nodes-updated and add_backend consolidted. 2021-12-13 20:26:00 -05:00
shnee 073ace2732 Added support for bridge network interfaces for libvirt. 2021-12-13 20:26:00 -05:00
shnee dda60c0b63 changed region to west and added code for backend state management 2021-12-13 20:26:00 -05:00
shnee 86acf7736d Simplified main. Added AMI module. 2021-12-13 20:26:00 -05:00
shnee 7ca4db8737 k8s-nodes initial work 2021-12-13 20:26:00 -05:00
shnee 98bb54726d Moved everything from k8s-nodes to the top-level. 2021-12-13 19:59:30 -05:00
shnee c229e1e0bb Shared state is working. Qeurying for default VPC. 2021-12-13 19:42:41 -05:00
shnee 3fd6b034d7 Branches k8s-nodes-updated and add_backend consolidted. 2021-12-13 16:09:46 -05:00
shnee f5fb896b9a Merge in k8s-nodes-updates. 2021-12-11 14:47:32 -05:00
shnee 5499a0e9da Merged in add_backend. 2021-12-11 14:43:35 -05:00
shnee e57963641b changed region to west and added code for backend state management 2021-12-10 15:32:10 -05:00
shnee 7de2ba1728 Added support for bridge network interfaces for libvirt. 2021-12-10 11:00:45 -05:00
shnee 6c2d3e3837 Updated get-vim-ips script to use hostnames.
- Made the qemu-agent content in the cloud-init config to be controlled
  by a 'install-qemu-agent' flag.
2021-12-10 10:01:06 -05:00
shnee fee62e0385 Updated get-vim-ips script to use hostnames.
- Made the qemu-agent content in the cloud-init config to be controlled
  by a 'install-qemu-agent' flag.
2021-12-09 23:13:00 -05:00
shnee 482e8d1027 Merged common changes from ansible-test to master. 2021-12-09 14:27:05 -05:00
shnee 5ea36d8626 libvirt bridged network interface
- Added support for libvirt VMs that use a bridged network interface.
2021-12-09 13:46:54 -05:00
shnee 10a88425ed Added Arch libvirt image. 2021-11-29 10:40:33 -05:00
shnee 10d01ff839 Simplified main. Added AMI module. 2021-11-26 16:06:19 -05:00
shnee ce3a5b39f5 Rolled back main.tf to have master and worker. 2021-11-26 15:21:32 -05:00
shnee ad0212a29d Added a script to poll AWS node status. 2021-11-26 15:01:54 -05:00
shnee 1787590da2 Use config map and added RHEL 7 & 8. 2021-11-18 11:41:26 -05:00
shnee 17c60e41bb rebase with master 2021-11-18 11:28:38 -05:00
shnee ec6bb824d0 Moved node-config to be local, added AMI vars. 2021-11-18 11:19:59 -05:00
shnee 852d8cfcf2 Update get-vm-ips.sh to work with new map config. 2021-11-18 10:45:58 -05:00
shnee c9ea3d4489 Make libvirt module accept config map. 2021-11-18 09:45:16 -05:00
shnee 9aa0a68be8 AWS nodes and user-data created from config map. 2021-11-17 21:50:07 -05:00
shnee 3088e2295f Added a aws_ami module. 2021-11-17 14:18:31 -05:00
shnee 091b459046 Recomment user-data from master. 2021-11-16 21:02:41 -05:00
shnee b4ac04fbd8 Added aws-ami module. 2021-11-16 21:01:34 -05:00
shnee 8724cede19 Create ansible invetory with get-vm-ips.sh 2021-11-16 14:38:06 -05:00
shnee 31a70766ec Added CentOS 7 & 8 and Arch 2021-11-16 14:36:57 -05:00
shnee e9df4cd1d6 k8s-nodes initial work 2021-11-15 14:01:22 -05:00
shnee 25794c641a Added arch AWS image. 2021-11-15 09:14:33 -05:00
shnee b0b959f28b Creates 1 amazn, 1 ubuntu to test ansible. 2021-11-14 11:49:25 -05:00
shnee f357d3dd5b Forgot to add aws-nodes files.
- Moved network_config.cfg to libvirt-nodes.
2021-11-12 21:58:22 -05:00
shnee cb59a5b2f3 Made cloud-init configs an input to libvirt-nodes. 2021-11-12 20:54:05 -05:00
shnee f8b894739f Fixed cloud-init for aws.
- Organized main.tf
- Still need to add cloud-init as an input parameter for the libvirt
  module.
2021-11-12 20:28:12 -05:00
shnee e3b15f952c Created aws-node module. 2021-11-12 18:31:01 -05:00
shnee 833352fda8 Moved AWS network resources into a aws-network module. 2021-11-12 15:55:25 -05:00
shnee a232bbfd71 Single AWS node is working. 2021-11-12 14:03:45 -05:00
shnee b2ae84be72 Tested with centos 7 image. 2021-11-11 18:37:17 -05:00
shnee 4a62875b8e Added outputs for IPs.
- Made sure node-memory ad node-vcpus is passed down to module.
- Fixed get-vm-ips.sh after move to module.
2021-11-11 14:50:45 -05:00
shnee 3d7bd95f78 node module is working. 2021-11-10 22:22:17 -05:00
shnee 474f6c746a Setting passwords and keys working via variables.
- Setting hostnames is working also.
2021-11-10 15:29:22 -05:00
shnee af17823d68 Setting keys and password with cloud-init working. 2021-11-10 13:59:07 -05:00
shnee b126da8acf Initial attempt is working. 2021-11-10 11:24:50 -05:00
shnee 483c44b695 Add example configs from libvirt provider. 2021-11-09 17:06:17 -05:00
shnee 2c0f1ff60e Initial commit 2021-10-06 09:04:00 -04:00
18 changed files with 379 additions and 72 deletions
+1
View File
@@ -44,6 +44,7 @@ terraform.rc
################################################################################ ################################################################################
k8s-key* k8s-key*
*admin-key*
STARTHERE STARTHERE
inventory inventory
+4
View File
@@ -26,6 +26,10 @@ chpasswd:
hostname: ${hostname} hostname: ${hostname}
fqdn: ${hostname} fqdn: ${hostname}
package_update: true
package_upgrade: true
package_reboot_if_required: true
%{ if install-qemu-agent } %{ if install-qemu-agent }
packages: packages:
# This are only necessary for libvirt. # This are only necessary for libvirt.
-11
View File
@@ -19,17 +19,6 @@ node-vcpus = 2
# 12 GiB # 12 GiB
# libvirt-node-disk-size = "${12 * 1073741824}" # libvirt-node-disk-size = "${12 * 1073741824}"
################################################################################
# AWS EC2 instance types
################################################################################
# 1 GiB, 1 vcpu, only one that is free.
# This one won't work with k8s because it requires at least 2 vcpus.
aws-ec2-instance-type = "t2.micro"
# 4 GiB, 2 vcpus
# aws-ec2-instnce-type = "t2.medium"
################################################################################ ################################################################################
# AWS images (AMIs) # AWS images (AMIs)
################################################################################ ################################################################################
+10 -4
View File
@@ -22,6 +22,10 @@ VM_NAME_PREFIX="$(
tail -n 1 | \ tail -n 1 | \
sed 's/^.*=\s*"\(.*\)"/\1/g')" sed 's/^.*=\s*"\(.*\)"/\1/g')"
PUBLIC_IP_OUTPUT="groups_hostnames_ips"
PRIVATE_IP_OUTPUT="groups_hostnames_private_ips"
IP_TYPE="$PRIVATE_IP_OUTPUT"
# This command stores the output data in the format below. # This command stores the output data in the format below.
# [ # [
# { # {
@@ -48,7 +52,7 @@ VM_NAME_PREFIX="$(
# } # }
# ] # ]
DATA="$(terraform show -json | \ DATA="$(terraform show -json | \
jq '.values.outputs.groups_hostnames_ips.value | to_entries | jq '.values.outputs.'"$IP_TYPE"'.value | to_entries |
map({group: .key, vms:.value | to_entries | map({group: .key, vms:.value | to_entries |
map({hostname:.key,ip:.value})})')" map({hostname:.key,ip:.value})})')"
@@ -80,13 +84,15 @@ for GROUP in $ANS_GROUPS; do
# HOSTNAME1=0.0.0.0 # HOSTNAME1=0.0.0.0
# HOSTNAME2=0.0.0.0 # HOSTNAME2=0.0.0.0
VARS="$( VARS="$(
echo $DATA | \ echo -n $DATA | \
jq '.[] | select(.group=="'"$GROUP"'") | .vms[] | jq '.[] | select(.group=="'"$GROUP"'") | .vms[] |
"\(.hostname)=\(.ip)"' | \ "\(.hostname)=\(.ip)"' | \
sed 's/"//g' | \ sed 's/"//g' | \
sed "s/$VM_NAME_PREFIX-//g" | \ sed "s/$VM_NAME_PREFIX-//g" | \
sed 's/-/_/g' sed 's/-/_/g'
)" )"
# Print the contents of $VARS converted to uppercase. # Print the contents of $VARS converted to uppercase. If it's not expty.
echo "${VARS^^}" if [ ! -z "$VARS" ]; then
echo "${VARS^^}"
fi
done done
+84 -11
View File
@@ -1,14 +1,53 @@
locals { locals {
k8s-subnets-ids = [
# module.aws-network-from-scratch.subnet.id,
module.aws-network-existing.subnet-by-name["subnet_1"].id,
module.aws-network-existing.subnet-by-name["subnet_3"].id,
]
nfs-subnets = [
# module.aws-network-from-scratch.subnet,
module.aws-network-existing.subnet-by-name["subnet_4"],
]
aws-security-group-id = module.aws-network-existing.default-sg.id
# aws-security-group-id = module.aws-network-from-scratch.default-security-group.id
nodes-config = { nodes-config = {
"master" = { "k8s-master" = {
base-image = var.centos8-ami base-image = var.ubuntu-ami
aws-ec2-type = var.t2-medium-4gib-2vcpu
subnet-ids = local.k8s-subnets-ids
num = 0
},
"k8s-worker" = {
base-image = var.ubuntu-ami
aws-ec2-type = var.t2-medium-4gib-2vcpu
subnet-ids = local.k8s-subnets-ids
num = 0
},
"ansible-test" = {
base-image = var.ubuntu-ami
aws-ec2-type = var.t2-micro-1gib-1vcpu
# subnet-ids = [module.aws-network-from-scratch.subnet.id]
subnet-ids = [module.aws-network-existing.subnet-by-name["subnet_2"].id]
num = 0
},
"nfs" = {
base-image = var.ubuntu-ami
aws-ec2-type = var.t2-micro-1gib-1vcpu
# subnet-ids = [module.aws-network-from-scratch.subnet.id]
subnet-ids = [module.aws-network-existing.subnet-by-name["subnet_4"].id]
num = 1
num-disks = 1
disk-size = 10
},
"proxy" = {
base-image = var.ubuntu-ami
aws-ec2-type = var.t2-micro-1gib-1vcpu
# subnet-ids = [module.aws-network-from-scratch.subnet.id]
subnet-ids = [module.aws-network-existing.subnet-by-name["subnet_4"].id]
private-ips = [var.aws-proxy-private-ip]
num = 1 num = 1
}, },
"worker" = {
base-image = var.centos8-ami
num = 2
}
} }
install-qemu-agent = false install-qemu-agent = false
} }
@@ -59,7 +98,10 @@ module "cloud-init-config" {
# } # }
module "aws-network-existing" { 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
existing-subnet-names = var.aws-existing-subnet-names
} }
################################################################################ ################################################################################
@@ -74,16 +116,41 @@ resource "aws_key_pair" "key" {
} }
} }
resource "aws_ebs_volume" "zfs" {
# TODO REM look at types.
availability_zone = local.nfs-subnets[0].availability_zone
size = local.nodes-config["nfs"].disk-size
encrypted = true
count = local.nodes-config["nfs"].num-disks
tags = {
Name = "zfs-disk-${count.index}"
}
}
resource "aws_volume_attachment" "mount-nfs-volume" {
device_name = "/dev/sd${element(var.aws-zfs-drive-letters, count.index)}"
instance_id = module.nodes["nfs"].nodes[0].id
count = local.nodes-config["nfs"].num-disks
volume_id = element(aws_ebs_volume.zfs, count.index).id
}
output "zfs-drive-letters" {
value = aws_volume_attachment.mount-nfs-volume.*.device_name
}
module "nodes" { module "nodes" {
for_each = local.nodes-config for_each = local.nodes-config
source = "./modules/aws-nodes" source = "./modules/aws-nodes"
ec2-instance-type = each.value.aws-ec2-type
ami = each.value.base-image ami = each.value.base-image
ec2-instance-type = var.aws-ec2-instance-type subnet-ids = each.value.subnet-ids
subnet-id = module.aws-network.subnet.id private-ips = try(each.value.private-ips, [])
security-group-ids = [module.aws-network.default-security-group.id] security-group-ids = [local.aws-security-group-id]
user-datas = lookup(module.cloud-init-config, each.key, null).user-datas user-datas = lookup(module.cloud-init-config, each.key, null).user-datas
num-nodes = each.value.num num-nodes = each.value.num
name-prefix = "${var.vm-name-prefix}-${each.key}" name-prefix = "${var.vm-name-prefix}-${each.key}"
# TODO add a input for the key so that it will show up as the key in the aws
# console.
} }
################################################################################ ################################################################################
@@ -127,8 +194,14 @@ module "nodes" {
# end libvirt # end libvirt
################################################################################ ################################################################################
# This will output a map of group => [{hostname, ip}]. # This will outpus a map of group => [{hostname, ip}].
# TODO A 'names' output needs to be added to libvirt. # TODO A 'names' output needs to be added to libvirt.
output "groups_hostnames_ips" { output "groups_hostnames_ips" {
value = { for type, node in module.nodes : type => zipmap(node.names, node.ips) } value = { for type, node in module.nodes : type => zipmap(node.names, node.ips) }
} }
# This will outpus a map of group => [{hostname, private_ip}].
# TODO Figure out how what to do about private_ips for libvirt.
output "groups_hostnames_private_ips" {
value = { for type, node in module.nodes : type => zipmap(node.names, node.private_ips) }
}
+37 -16
View File
@@ -1,31 +1,52 @@
locals { locals {
amis = { amis = {
amzn2 = { amzn2 = {
owner-id = "137112412989" # us-east-2
# owner-id = "137112412989"
# us-gov-west-1
owner-id = "045324592363"
name = "amzn2-ami-hvm-2*x86_64-gp2" name = "amzn2-ami-hvm-2*x86_64-gp2"
}, },
ubuntu = { ubuntu = {
owner-id = "099720109477" # us-east-2
# owner-id = "099720109477"
# us-gov-west-1
owner-id = "513442679011"
name = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*" name = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"
}, },
centos7 = { # centos7 = {
owner-id = "125523088429" # # us-east-2
name = "CentOS 7.*x86_64" # # owner-id = "125523088429"
}, # # us-gov-west-1
centos8 = { # # owner-id = THERE IS NO CENTOS7 IMAGE in us-gov-west-1!!
owner-id = "125523088429" # name = "CentOS 7.*x86_64"
name = "CentOS 8.*x86_64" # },
}, # centos8 = {
arch = { # # us-east-2
owner-id = "093273469852" # # owner-id = "125523088429"
name = "arch-linux-lts-hvm*x86_64-ebs" # # us-gov-west-1
}, # # owner-id = THERE IS NO CENTOS8 IMAGE in us-gov-west-1!!
# name = "CentOS 8.*x86_64"
# },
# arch = {
# # us-east-2
# # owner-id = "093273469852"
# # us-gov-west-1
# # owner-id = THERE IS NO ARCH IMAGE in us-gov-west-1!!
# name = "arch-linux-lts-hvm*x86_64-ebs"
# },
rhel7 = { rhel7 = {
owner-id = "309956199498" # us-east-2
# owner-id = "309956199498"
# us-gov-west-1
owner-id = "219670896067"
name = "RHEL-7.*HVM*x86_64*GP2" name = "RHEL-7.*HVM*x86_64*GP2"
}, },
rhel8 = { rhel8 = {
owner-id = "309956199498" # us-east-2
# owner-id = "309956199498"
# us-gov-west-1
owner-id = "219670896067"
name = "RHEL-8.*HVM*x86_64*GP2" name = "RHEL-8.*HVM*x86_64*GP2"
} }
} }
+12
View File
@@ -21,3 +21,15 @@ data "aws_subnet" "subnets" {
for_each = toset(data.aws_subnets.subnet-ids.ids) for_each = toset(data.aws_subnets.subnet-ids.ids)
id = each.key 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 -2
View File
@@ -2,16 +2,25 @@ output "default-vpc" {
value = data.aws_vpc.default value = data.aws_vpc.default
} }
output "default-sg" {
value = data.aws_security_group.default
}
output "subnets" { output "subnets" {
description = "An array of all subnets in default-vpc." description = "An array of all subnets in default-vpc."
value = data.aws_subnet.subnets value = data.aws_subnet.subnets
} }
output "k8s-subnets" { output "one-subnet-per-az" {
description = "An array of subnets to be used for k8s VMs. These subnets were chosen by selecting a single subnet from each availability_zone." description = "An array of subnets that selects 1 subnet per az."
value = [for k,v in local.az-to-subnets : v[0]] 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" { output "az-to-subnets" {
description = "A map of availability zone to array of subnets that are in thet availability zone." description = "A map of availability zone to array of subnets that are in thet availability zone."
value = local.az-to-subnets value = local.az-to-subnets
+10 -1
View File
@@ -1,4 +1,13 @@
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" { variable "default-vpc-name" {
description = "The name of the existing default VPC. This module will query AWS for a VPC with this name," description = "The name of the existing default VPC. This module will query AWS for a VPC with this name,"
default = "Managed VPC" }
variable "existing-subnet-names" {
description = "A list of subnet names that already exist in default-vpc-name"
default = []
type = list(string)
} }
+67
View File
@@ -0,0 +1,67 @@
resource "aws_vpc" "vpc" {
cidr_block = var.vpc-cidr-block
tags = {
Name = "${var.name-prefix}-vpc"
}
}
resource "aws_subnet" "subnet" {
vpc_id = aws_vpc.vpc.id
cidr_block = var.subnet-cidr-block
# availability_zone = var.avail_zone
tags = {
Name = "${var.name-prefix}-subnet"
}
}
resource "aws_default_security_group" "sg" {
vpc_id = aws_vpc.vpc.id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = var.admin-ips
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
prefix_list_ids = []
}
tags = {
Name = "${var.name-prefix}-ssh-from-admins-sg"
}
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.vpc.id
tags = {
Name = "${var.name-prefix}-igw"
}
}
resource "aws_default_route_table" "route-table" {
default_route_table_id = aws_vpc.vpc.main_route_table_id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.igw.id
}
# default route, mapping VPC CIDR block to "local", created implicitly and
# cannot be specified.
tags = {
Name = "${var.name-prefix}-route-table"
}
}
# Associate subnet with Route Table
resource "aws_route_table_association" "a-rtb-subnet" {
subnet_id = aws_subnet.subnet.id
route_table_id = aws_default_route_table.route-table.id
}
+11
View File
@@ -0,0 +1,11 @@
output "vpc" {
value = aws_vpc.vpc
}
output "subnet" {
value = aws_subnet.subnet
}
output "default-security-group" {
value = aws_default_security_group.sg
}
+23
View File
@@ -0,0 +1,23 @@
variable "admin-ips" {
description = "A list of ips or cidr blocks that are allowed to connect to the nodes."
type = list(string)
}
variable "name-prefix" {
default = "tf"
description = "This prefix will be used in all the names of the resources creates in our AWS network."
type = string
}
variable "subnet-cidr-block" {
default = "10.0.1.0/24"
description = "The address space to be used for this subnet."
type = string
}
variable "vpc-cidr-block" {
default = "10.0.0.0/16"
description = "The address space to be used for out networks VPC."
type = string
}
+5 -3
View File
@@ -1,10 +1,12 @@
resource "aws_instance" "nodes" { resource "aws_instance" "nodes" {
ami = var.ami ami = var.ami
instance_type = var.ec2-instance-type instance_type = var.ec2-instance-type
# TODO REM double check this key. # TODO Make this a variable.
# key_name = aws_key_pair.debug1.key_name
associate_public_ip_address = true associate_public_ip_address = true
subnet_id = var.subnet-id subnet_id = element(var.subnet-ids, count.index % length(var.subnet-ids))
# Set a private IP if var.private-ips is not empty, otherwise let AWS assign
# the IP.
private_ip = length(var.private-ips) == 0 ? null : element(var.private-ips, count.index)
vpc_security_group_ids = var.security-group-ids vpc_security_group_ids = var.security-group-ids
user_data = element(var.user-datas.*.rendered, count.index) user_data = element(var.user-datas.*.rendered, count.index)
count = var.num-nodes count = var.num-nodes
+8
View File
@@ -2,6 +2,14 @@ output "ips" {
value = aws_instance.nodes.*.public_ip value = aws_instance.nodes.*.public_ip
} }
output "private_ips" {
value = aws_instance.nodes.*.private_ip
}
output "names" { output "names" {
value = aws_instance.nodes.*.tags.Name value = aws_instance.nodes.*.tags.Name
} }
output "nodes" {
value = aws_instance.nodes
}
+9 -3
View File
@@ -21,13 +21,19 @@ variable "num-nodes" {
type = number type = number
} }
variable "private-ips" {
default = []
description = "A list of private IP addresses to use for the nodes. If the list is empty then each node will get an IP assigned from AWS."
type = list(string)
}
variable "user-datas" { variable "user-datas" {
description = "A list of cloud-init configs that get applied to their corresponding node." description = "A list of cloud-init configs that get applied to their corresponding node."
} }
variable "subnet-id" { variable "subnet-ids" {
description = "The ID of the subnet that all the nodes will be added to." description = "An array of subnet ids. These subnets will be round robined as the subnet to use for each node."
type = string type = list(string)
} }
variable "security-group-ids" { variable "security-group-ids" {
+8 -7
View File
@@ -1,20 +1,21 @@
provider "aws" { provider "aws" {
region = "us-gov-west-1" region = var.aws-region
# profile = <aws cli profile>
} }
terraform { terraform {
required_version = ">= 1.0.8" required_version = ">= 1.0.8"
backend "s3" { backend "s3" {
bucket = "mss-terraform-state" bucket = "mss-terraform-state"
key = "global/s3/terraform.tfstate" key = "global/s3/terraform.tfstate"
region = "us-gov-west-1" region = "us-gov-west-1"
dynamodb_table = "mss-terraform-state-lock" dynamodb_table = "mss-terraform-state-lock"
encrypt = true encrypt = true
} }
required_providers { required_providers {
+74 -9
View File
@@ -1,11 +1,34 @@
variable "admin-ips" { variable "admin-ips" {
default = ["0.0.0.0/0"]
description = "A list of ips or cidr blocks that are allowed to connect to the nodes." description = "A list of ips or cidr blocks that are allowed to connect to the nodes."
type = list(string) type = list(string)
} }
variable "aws-ec2-instance-type" { variable "aws-zfs-drive-letters" {
default = "t2.micro" default = ["f", "g", "h", "i", "j"]
description = "The AWS instance type to use for all nodes." description = "These are the drove letters to use when attaching EBS volumes, ie. /dev/sdf or /dev/sdg"
type = list(string)
}
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-existing-subnet-names" {
description = "A list of subnet names that already exist in aws-existing-vpc-name"
default = []
type = list(string)
}
variable "aws-proxy-private-ip" {
description = "The private IP to request for the proxy instance."
type = string
} }
variable "aws-region" { variable "aws-region" {
@@ -33,6 +56,7 @@ variable "disk-image-pool-name" {
} }
variable "libvirt-connection-url" { variable "libvirt-connection-url" {
default = "nobody@localhost"
description = "The libvirt connection URI, ie. qemu+ssh://<user>@<host>/system" description = "The libvirt connection URI, ie. qemu+ssh://<user>@<host>/system"
} }
@@ -89,43 +113,84 @@ variable "vm-name-prefix" {
################################################################################ ################################################################################
# AWS AMI vars # AWS AMI vars
# These variables are really mor like constants. Using variables improves # These variables are really more like constants. Using variables improves
# readability. The defaults are manually updated. Use the aws-amis module to get # readability. The defaults are manually updated. Use the aws-amis module to get
# the latest for each distro. # the latest for each distro.
################################################################################ ################################################################################
variable "amzn2-ami" { variable "amzn2-ami" {
default = "ami-0dd0ccab7e2801812" # us-east-2
# default = "ami-0dd0ccab7e2801812"
# us-gov-west-1
default = "ami-098bf51d9a35299f0"
description = "The AMI to use for Amazon Linux 2." description = "The AMI to use for Amazon Linux 2."
} }
variable "ubuntu-ami" { variable "ubuntu-ami" {
default = "ami-06c7d6c0987eaa46c" # us-east-2
# default = "ami-06c7d6c0987eaa46c"
# us-gov-west-1
default = "ami-087ee83c8de303181"
description = "The AMI to use for Ubuntu." description = "The AMI to use for Ubuntu."
} }
variable "centos7-ami" { variable "centos7-ami" {
# us-east-2
default = "ami-00f8e2c955f7ffa9b" default = "ami-00f8e2c955f7ffa9b"
description = "The AMI to use for CentOS 7." description = "The AMI to use for CentOS 7."
} }
variable "centos8-ami" { variable "centos8-ami" {
# us-east-2
default = "ami-057cacbfbbb471bb3" default = "ami-057cacbfbbb471bb3"
description = "The AMI to use for CentOS 8." description = "The AMI to use for CentOS 8."
} }
variable "arch-ami" { variable "arch-ami" {
# us-east-2
default = "ami-02653f06de985e3ba" default = "ami-02653f06de985e3ba"
description = "The AMI to use for Arch Linux." description = "The AMI to use for Arch Linux."
} }
variable "rhel7-ami" { variable "rhel7-ami" {
default = "ami-0a509b3c2a4d05b3f" # us-east-2
# default = "ami-0a509b3c2a4d05b3f"
# us-gov-west-1
default = "ami-04ccdf5793086ea95"
description = "The AMI to use for RHEL 7." description = "The AMI to use for RHEL 7."
} }
variable "rhel8-ami" { variable "rhel8-ami" {
default = "ami-0d871ca8a77af2948" # us-east-2
# default = "ami-0d871ca8a77af2948"
# us-gov-west-1
default = "ami-0b1f10cd1cd107dd2"
description = "The AMI to use for RHEL 8." description = "The AMI to use for RHEL 8."
} }
################################################################################
# AWS EC2 types.
# These variables are really more like constants. Using variables improves
# readability.
################################################################################
variable "t2-micro-1gib-1vcpu" {
description = "t2.micro EC2 instance with 1 GiB mem and 1 vCPU."
default = "t2.micro"
}
variable "t2-medium-4gib-2vcpu" {
description = "t2.medium EC2 instance with 4 GiB mem and 2 vCPUs."
default = "t2.medium"
}
variable "t2-large-8gib-2vcpu" {
description = "t2.large EC2 instance with 8 GiB mem and 2 vCPUs."
default = "t2.large"
}
variable "t2-xlarge-16gib-4vcpu" {
description = "t2.xlarge EC2 instance with 16 GiB mem and 4 vCPUs."
default = "t2.xlarge"
}
################################################################################ ################################################################################
# Libvirt Images # Libvirt Images
# These variables are really mor like constants. Using variables improves # These variables are really more like constants. Using variables improves
# readability. The defaults are manually updated. # readability. The defaults are manually updated.
################################################################################ ################################################################################