|
|
@ -19,9 +19,9 @@ module "aws-vpc" { |
|
|
|
aws_cluster_name = "${var.aws_cluster_name}" |
|
|
|
aws_vpc_cidr_block = "${var.aws_vpc_cidr_block}" |
|
|
|
aws_avail_zones="${var.aws_avail_zones}" |
|
|
|
|
|
|
|
aws_cidr_subnets_private="${var.aws_cidr_subnets_private}" |
|
|
|
aws_cidr_subnets_public="${var.aws_cidr_subnets_public}" |
|
|
|
default_tags="${var.default_tags}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -35,6 +35,7 @@ module "aws-elb" { |
|
|
|
aws_subnet_ids_public="${module.aws-vpc.aws_subnet_ids_public}" |
|
|
|
aws_elb_api_port = "${var.aws_elb_api_port}" |
|
|
|
k8s_secure_api_port = "${var.k8s_secure_api_port}" |
|
|
|
default_tags="${var.default_tags}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -61,11 +62,11 @@ resource "aws_instance" "bastion-server" { |
|
|
|
|
|
|
|
key_name = "${var.AWS_SSH_KEY_NAME}" |
|
|
|
|
|
|
|
tags { |
|
|
|
Name = "kubernetes-${var.aws_cluster_name}-bastion-${count.index}" |
|
|
|
Cluster = "${var.aws_cluster_name}" |
|
|
|
Role = "bastion-${var.aws_cluster_name}-${count.index}" |
|
|
|
} |
|
|
|
tags = "${merge(var.default_tags, map( |
|
|
|
">an class="s2">Name", "kubernetes-${var.aws_cluster_name}-bastion-${count.index}", |
|
|
|
">an class="s2">Cluster", "${var.aws_cluster_name}", |
|
|
|
">an class="s2">Role", "bastion-${var.aws_cluster_name}-${count.index}" |
|
|
|
))}" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -92,11 +93,11 @@ resource "aws_instance" "k8s-master" { |
|
|
|
key_name = "${var.AWS_SSH_KEY_NAME}" |
|
|
|
|
|
|
|
|
|
|
|
tags { |
|
|
|
Name = "kubernetes-${var.aws_cluster_name}-master${count.index}" |
|
|
|
Cluster = "${var.aws_cluster_name}" |
|
|
|
Role = "master" |
|
|
|
} |
|
|
|
tags = "${merge(var.default_tags, map( |
|
|
|
">an class="s2">Name", "kubernetes-${var.aws_cluster_name}-master${count.index}", |
|
|
|
">an class="s2">Cluster", "${var.aws_cluster_name}", |
|
|
|
">an class="s2">Role", "master" |
|
|
|
))}" |
|
|
|
} |
|
|
|
|
|
|
|
resource "aws_elb_attachment" "attach_master_nodes" { |
|
|
@ -121,12 +122,11 @@ resource "aws_instance" "k8s-etcd" { |
|
|
|
|
|
|
|
key_name = "${var.AWS_SSH_KEY_NAME}" |
|
|
|
|
|
|
|
|
|
|
|
tags { |
|
|
|
Name = "kubernetes-${var.aws_cluster_name}-etcd${count.index}" |
|
|
|
Cluster = "${var.aws_cluster_name}" |
|
|
|
Role = "etcd" |
|
|
|
} |
|
|
|
tags = "${merge(var.default_tags, map( |
|
|
|
"Name", "kubernetes-${var.aws_cluster_name}-etcd${count.index}", |
|
|
|
"Cluster", "${var.aws_cluster_name}", |
|
|
|
"Role", "etcd" |
|
|
|
))}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -146,11 +146,11 @@ resource "aws_instance" "k8s-worker" { |
|
|
|
key_name = "${var.AWS_SSH_KEY_NAME}" |
|
|
|
|
|
|
|
|
|
|
|
tags { |
|
|
|
Name = "kubernetes-${var.aws_cluster_name}-worker${count.index}" |
|
|
|
Cluster = "${var.aws_cluster_name}" |
|
|
|
Role = "worker" |
|
|
|
} |
|
|
|
tags = "${merge(var.default_tags, map( |
|
|
|
">an class="s2">Name", "kubernetes-${var.aws_cluster_name}-worker${count.index}", |
|
|
|
">an class="s2">Cluster", "${var.aws_cluster_name}", |
|
|
|
">an class="s2">Role", "worker" |
|
|
|
))}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -164,10 +164,10 @@ data "template_file" "inventory" { |
|
|
|
template = "${file("${path.module}/templates/inventory.tpl")}" |
|
|
|
|
|
|
|
vars { |
|
|
|
public_ip_address_bastion = "${join("\n",formatlist("bastion ansible_ssh_host=%s" , aws_instance.bastion-server.*.public_ip))}" |
|
|
|
connection_strings_master = "${join("\n",formatlist("%s ansible_ssh_host=%s",aws_instance.k8s-master.*.tags.Name, aws_instance.k8s-master.*.private_ip))}" |
|
|
|
connection_strings_node = "${join("\n", formatlist("%s ansible_ssh_host=%s", aws_instance.k8s-worker.*.tags.Name, aws_instance.k8s-worker.*.private_ip))}" |
|
|
|
connection_strings_etcd = "${join("\n",formatlist("%s ansible_ssh_host=%s", aws_instance.k8s-etcd.*.tags.Name, aws_instance.k8s-etcd.*.private_ip))}" |
|
|
|
public_ip_address_bastion = "${join("\n",formatlist("bastion ansible_host=%s" , aws_instance.bastion-server.*.public_ip))}" |
|
|
|
connection_strings_master = "${join("\n",formatlist("%s ansible_host=%s",aws_instance.k8s-master.*.tags.Name, aws_instance.k8s-master.*.private_ip))}" |
|
|
|
connection_strings_node = "${join("\n", formatlist("%s ansible_host=%s", aws_instance.k8s-worker.*.tags.Name, aws_instance.k8s-worker.*.private_ip))}" |
|
|
|
connection_strings_etcd = "${join("\n",formatlist("%s ansible_host=%s", aws_instance.k8s-etcd.*.tags.Name, aws_instance.k8s-etcd.*.private_ip))}" |
|
|
|
list_master = "${join("\n",aws_instance.k8s-master.*.tags.Name)}" |
|
|
|
list_node = "${join("\n",aws_instance.k8s-worker.*.tags.Name)}" |
|
|
|
list_etcd = "${join("\n",aws_instance.k8s-etcd.*.tags.Name)}" |
|
|
|