forked from vmware-archive/terraforming-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
138 lines (106 loc) · 4.03 KB
/
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
terraform {
required_version = "< 0.12.0"
}
locals {
ops_man_subnet_id = "${var.ops_manager_private ? element(module.infra.infrastructure_subnet_ids, 0) : element(module.infra.public_subnet_ids, 0)}"
bucket_suffix = "${random_integer.bucket.result}"
default_tags = {
Environment = "${var.env_name}"
Application = "Cloud Foundry"
}
actual_tags = "${merge(var.tags, local.default_tags)}"
}
resource "random_integer" "bucket" {
min = 1
max = 100000
}
module "infra" {
source = "../modules/infra"
region = "${var.region}"
env_name = "${var.env_name}"
availability_zones = "${var.availability_zones}"
vpc_cidr = "${var.vpc_cidr}"
internetless = "${var.internetless}"
hosted_zone = "${var.hosted_zone}"
dns_suffix = "${var.dns_suffix}"
tags = "${local.actual_tags}"
}
module "ops_manager" {
source = "../modules/ops_manager"
vm_count = "${var.ops_manager_vm ? 1 : 0}"
optional_count = "${var.optional_ops_manager ? 1 : 0}"
subnet_id = "${local.ops_man_subnet_id}"
env_name = "${var.env_name}"
region = "${var.region}"
ami = "${var.ops_manager_ami}"
optional_ami = "${var.optional_ops_manager_ami}"
instance_type = "${var.ops_manager_instance_type}"
private = "${var.ops_manager_private}"
vpc_id = "${module.infra.vpc_id}"
vpc_cidr = "${var.vpc_cidr}"
dns_suffix = "${var.dns_suffix}"
zone_id = "${module.infra.zone_id}"
additional_iam_roles_arn = ["${module.pas.iam_pas_bucket_role_arn}"]
bucket_suffix = "${local.bucket_suffix}"
tags = "${local.actual_tags}"
}
module "pas_certs" {
source = "../modules/certs"
subdomains = ["*.apps", "*.sys", "*.login.sys", "*.uaa.sys"]
env_name = "${var.env_name}"
dns_suffix = "${var.dns_suffix}"
ssl_cert = "${var.ssl_cert}"
ssl_private_key = "${var.ssl_private_key}"
ssl_ca_cert = "${var.ssl_ca_cert}"
ssl_ca_private_key = "${var.ssl_ca_private_key}"
}
module "isoseg_certs" {
source = "../modules/certs"
subdomains = ["*.iso"]
env_name = "${var.env_name}"
dns_suffix = "${var.dns_suffix}"
resource_name = "isoseg"
ssl_cert = "${var.isoseg_ssl_cert}"
ssl_private_key = "${var.isoseg_ssl_private_key}"
ssl_ca_cert = "${var.isoseg_ssl_ca_cert}"
ssl_ca_private_key = "${var.isoseg_ssl_ca_private_key}"
}
module "pas" {
source = "../modules/pas"
env_name = "${var.env_name}"
region = "${var.region}"
availability_zones = "${var.availability_zones}"
vpc_cidr = "${var.vpc_cidr}"
vpc_id = "${module.infra.vpc_id}"
route_table_ids = "${module.infra.deployment_route_table_ids}"
public_subnet_ids = "${module.infra.public_subnet_ids}"
internetless = "${var.internetless}"
bucket_suffix = "${local.bucket_suffix}"
zone_id = "${module.infra.zone_id}"
dns_suffix = "${var.dns_suffix}"
create_backup_pas_buckets = "${var.create_backup_pas_buckets}"
create_versioned_pas_buckets = "${var.create_versioned_pas_buckets}"
ops_manager_iam_user_name = "${module.ops_manager.ops_manager_iam_user_name}"
iam_ops_manager_role_name = "${module.ops_manager.ops_manager_iam_role_name}"
create_isoseg_resources = "${var.create_isoseg_resources}"
tags = "${local.actual_tags}"
}
module "rds" {
source = "../modules/rds"
rds_db_username = "${var.rds_db_username}"
rds_instance_class = "${var.rds_instance_class}"
rds_instance_count = "${var.rds_instance_count}"
engine = "mariadb"
engine_version = "10.1.31"
db_port = 3306
env_name = "${var.env_name}"
availability_zones = "${var.availability_zones}"
vpc_cidr = "${var.vpc_cidr}"
vpc_id = "${module.infra.vpc_id}"
tags = "${local.actual_tags}"
}