/* * https://wiki.nuxeo.com/display/INFRA/Cloud+Provisioning */ /////////////////////////////////////////////////////////////////////// // Load defaults /////////////////////////////////////////////////////////////////////// /*module "defaults" { source = "./defaults" region = "${var.region}" cidr = "${var.cidr}" }*/ /////////////////////////////////////////////////////////////////////// // RESOURCES /////////////////////////////////////////////////////////////////////// module "net" { source = "./net/" stack_name = "${var.stack_name}" region = "${var.region}" vpc_id = "${var.vpc_id}" public_subnets = ["10.0.10.0/24"] private_subnets = ["10.0.11.0/24"] private_db_subnets = ["10.0.100.0/24","10.0.101.0/24"] } #------------- # DNS Entry for Cloud Customer #------------- resource "aws_route53_record" "dns" { zone_id = "Z1EFT3O5K9NMCJ" // Zone ID for nuxeocloud.com name = "${name}" type = "CNAME" ttl = "300" weighted_routing_policy { weight = 90 } set_identifier = "${var.stack_name}" records = ["${var.stack_name}.nuxeocloud.com"] } # ------------------------------------- # S3 buckets:w for Nuxeo and for Backups # ------------------------------------- module "s3" { source = "./s3/" stack_name = "${var.stack_name}" cust_id = "${sha256("${var.stack_name}")}" } # ------------------------- # RDS Postgres Database # ------------------------- module "rds" { source = "./rds/" region = "${var.region}" stack_name = "${var.stack_name}" database_name = "nuxeo" 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)}"] subnet_ids = ["${element(module.net.db_private, 0)}", "${element(module.net.db_private, 1)}"] } #------------------------- # Elastic Cache Redis #------------------------- module "elasticcache" { source = "./elasticcache" stack_name = "${var.stack_name}-redis" engine_version = "${engine_version}" node_type = "$${var.node_type}" security_group_ids = ["${module.net.sg_internal_id}"] private_subnet_ids = ["${module.net.db_private}"] } #------------------------- # EC2 Instances #------------------------- module "nuxeo" { source = "./instance/" # Variables for creating an instance stack_name = "${var.stack_name}-nuxeo" instance_name = "${var.stack_name}-nuxeo-instance" os_release = "${os_release}" instance_type = "${var.instance_type}" public_key_path ="${var.public_key_path}" secgroup = ["${module.net.sg_internal_id}"] ami = "ami-111111" # public_key_path="/path/to/my/pub_key" subnet_id="${element(module.net.private_subnets, 0)}" } #------------------------- # Bastion EC2 Instances #------------------------- module "bastion" { source = "bastion/" vpc_id = "${var.vpc_id}" allowed_network="10.0.0.0/16" subnet_id="${element(module.net.private_subnets, 0)}" }