|
@@ -1,30 +1,15 @@
|
|
|
/*
|
|
|
* https://wiki.nuxeo.com/display/INFRA/Cloud+Provisioning
|
|
|
-* 1) Create Subnets for the Stack
|
|
|
-* - On Public with a /24 size.
|
|
|
-* - One private Subnet to run Nuxeo
|
|
|
-* - at least 2 Private Subnets for Databases
|
|
|
-* 2) Create a NAT Gateway in one of the Public Subnets
|
|
|
-* 3) Create a Route with the Internet Gateway as default route, associate it with the Public Subnet(s)
|
|
|
-* 4) Create a Route with the NAT Gateway as default route, *that should be associated to all Private Subnets when they are created*
|
|
|
-* 5) Create a Security Group for ELBs that accepts HTTP and HTTPS from anywhere
|
|
|
-* 6) Create a Security Group for Bastion Hosts that accepts SSH from anywhere
|
|
|
-*
|
|
|
-* 7) Create a Bastion Host with bastion host SG associated to ti, install NTP and Userify on it
|
|
|
*/
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
// RESOURCES
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
-resource "random_id" "customer" {
|
|
|
- byte_length = 8
|
|
|
-}
|
|
|
-
|
|
|
module "net" {
|
|
|
source = "./net/"
|
|
|
|
|
|
- stack_name = "${var.stack_name}"
|
|
|
- region = "${var.aws_region}"
|
|
|
+ stack_name = "${var.stack_name}"
|
|
|
+ region = "${var.region}"
|
|
|
vpc_id = "${var.vpc_id}"
|
|
|
|
|
|
public_subnets = ["10.0.10.0/24"]
|
|
@@ -54,7 +39,6 @@ resource "aws_route53_record" "dns" {
|
|
|
module "s3" {
|
|
|
source = "./s3/"
|
|
|
stack_name = "${var.stack_name}"
|
|
|
- #cust_id = "${random_id.customer.b64}"
|
|
|
cust_id = "${uuid()}"
|
|
|
}
|
|
|
|
|
@@ -64,11 +48,11 @@ module "s3" {
|
|
|
# -------------------------
|
|
|
module "rds" {
|
|
|
source = "./rds/"
|
|
|
- region = "${var.aws_region}"
|
|
|
+ region = "${var.region}"
|
|
|
stack_name = "${var.stack_name}"
|
|
|
database_name = "nuxeo"
|
|
|
- rds_allocated_storage = "10"
|
|
|
- rds_engine_version = "9.4.7"
|
|
|
+ rds_allocated_storage = "${var.rds_allocated_storage}"
|
|
|
+ rds_engine_version = "${rds_engine_version}"
|
|
|
security_group_ids = ["${module.net.sg_internal_id}"]
|
|
|
#subnet_ids = ["${aws_subnet.db_private.0.id}", "${aws_subnet.db_private.1.id}"]
|
|
|
#db_private_subnets = ["${element(module.net.db_private, 0)}", "${element(module.net.db_private, 1)}"]
|
|
@@ -83,8 +67,8 @@ module "rds" {
|
|
|
module "elasticcache" {
|
|
|
source = "./elasticcache"
|
|
|
stack_name = "${var.stack_name}-redis"
|
|
|
- engine_version = "3.2.4"
|
|
|
- node_type = "cache.t2.micro"
|
|
|
+ engine_version = "${engine_version}"
|
|
|
+ node_type = "$${var.node_type}"
|
|
|
security_group_ids = ["${module.net.sg_internal_id}"]
|
|
|
private_subnet_ids = ["${module.net.db_private}"]
|
|
|
}
|
|
@@ -97,13 +81,17 @@ module "nuxeo" {
|
|
|
# Variables for creating an instance
|
|
|
stack_name = "${var.stack_name}-nuxeo"
|
|
|
instance_name = "${var.stack_name}-nuxeo-instance"
|
|
|
- os_release = "xenial"
|
|
|
- instance_type = "t2.micro"
|
|
|
+ os_release = "${os_release}"
|
|
|
+ instance_type = "${var.instance_type}"
|
|
|
public_key_path ="${var.public_key_path}"
|
|
|
# public_key_path="/path/to/my/pub_key"
|
|
|
subnet_id="${element(module.net.private_subnets, 0)}"
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+#-------------------------
|
|
|
+# Bastion EC2 Instances
|
|
|
+#-------------------------
|
|
|
module "bastion" {
|
|
|
source = "bastion/"
|
|
|
|
|
@@ -111,5 +99,3 @@ module "bastion" {
|
|
|
allowed_network="10.0.0.0/16"
|
|
|
subnet_public="${module.net.public_subnets}"
|
|
|
}
|
|
|
-
|
|
|
-
|