-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathha-management.main.tf
94 lines (71 loc) · 3.02 KB
/
ha-management.main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
module "networking" {
source = "./modules/aws/network"
vpc_name = "${var.aws_env_name}"
vpc_cidr = "${var.aws_vpc_cidr}"
region = "${var.aws_region}"
public_subnet_cidrs = "${var.aws_public_subnet_cidrs}"
private_subnet_cidrs = "${var.aws_private_subnet_cidrs}"
azs = "${var.aws_subnet_azs}"
}
#module "database" {
# source = "./modules/aws/data/rds_backed"
#
# rds_instance_name = "${var.aws_env_name}-rancher-db"
# database_password = "${var.database_password}"
# vpc_id = "${module.networking.vpc_id}"
# source_cidr_blocks = "${concat(split(",",var.aws_public_subnet_cidrs),split(",", var.aws_private_subnet_cidrs))}"
# rds_instance_class = "${var.aws_rds_instance_class}"
# db_subnet_ids = "${concat(split(",", module.networking.private_subnet_ids))}"
#}
module "ec2_database" {
source = "./modules/aws/data/ec2_backed"
name = "${var.aws_env_name}"
availability_zone = "${element(split(",", var.aws_subnet_azs), 0)}"
vpc_id = "${module.networking.vpc_id}"
ami_id = "${var.aws_ami_id}"
instance_type = "${var.aws_instance_type}"
source_cidr_blocks = "${concat(split(",",var.aws_public_subnet_cidrs),split(",", var.aws_private_subnet_cidrs))}"
database_password = "${var.database_password}"
subnet_id = "${element(split(",", module.networking.private_subnet_ids), 0)}"
primary_snapshot_id = "${var.primary_snapshot_id}"
backup_snapshot_id = "${var.backup_snapshot_id}"
ip_address = "${var.ec2_database_ip_address}"
}
module "compute" {
source = "./modules/aws/compute/ha-servers"
name = "${var.aws_env_name}-compute"
ami_id = "${var.aws_ami_id}"
instance_type = "${var.aws_instance_type}"
ssh_key_name = "${var.aws_ssh_key_name}"
load_balancers = "${module.networking.public_elbs}"
security_groups = "${module.networking.compute_security_groups}"
database_endpoint = "${element(split(":", module.ec2_database.endpoint),0)}"
database_name = "${module.ec2_database.name}"
database_user = "${module.ec2_database.username}"
database_password = "${var.database_encrypted_password}"
encryption_key = "${var.encryption_key}"
rancher_version = "${var.rancher_version}"
registration_url = "${var.registration_url}"
ca_chain = "${var.ca_chain}"
server_cert = "${var.server_cert}"
server_private_key = "${var.server_private_key}"
#azs = "${var.aws_subnet_azs}"
subnet_ids = "${module.networking.public_subnet_ids}"
}
output "subnet_ids" {
value = "${concat(split(",", module.networking.private_subnet_ids),split(",", module.networking.public_subnet_ids))}"
}
output "vpc_id" {
value = "${module.networking.vpc_id}"
}
output "db_endpoint" {
value = "${module.ec2_database.endpoint}"
}
output "userdata" {
value = "${module.compute.userdata}"
}