Roberto Barbosa 8 лет назад
Родитель
Сommit
a607f85df4
1 измененных файлов с 15 добавлено и 54 удалено
  1. 15 54
      nuxeo/main.tf

+ 15 - 54
nuxeo/main.tf

@@ -1,6 +1,6 @@
 /*
-* 1) Create Public Subnet with a /24 size (HA: create one in at least 3 different availability zones)
-
+* https://wiki.nuxeo.com/display/INFRA/Cloud+Provisioning
+* 1) Create Public Subnet with a /24 size. One private Subnet to run Nuxeo and at least 2 Private Subnets for Data
 * 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*
@@ -9,38 +9,11 @@
 * 7) Create a Bastion Host with bastion host SG associated to ti, install NTP and Userify on it
 */
 
-#-------------------
-# VARIABLES
-#-------------------
-variable "stack_name" {
-	default = "Name for this stack like customer-Name or project-name"
-}
-variable "aws_region" {}
-variable "vpc_id" {}
-
-// Variables for providers used in this module
-variable "aws_access_key" {}
-variable "aws_secret_key" {}
-
-// Deployer SSH Pub SSH keys
-variable "public_key_path" {}
-
-
-#-------------
-# AWS Provider
-#-------------
-provider "aws" {
-  access_key = "${var.aws_access_key}"
-  secret_key = "${var.aws_secret_key}"
-  region     = "${var.aws_region}"
-}
-
-data "aws_availability_zones" "all" {}
 ///////////////////////////////////////////////////////////////////////
 // RESOURCES
 ///////////////////////////////////////////////////////////////////////
 resource "random_id" "customer" {
-  byte_length = 8
+  byte_length = 16
 }
 
 module "net" {
@@ -71,30 +44,19 @@ module "net" {
 #  records = ["${var.stack_name}.nuxeocloud.com"]
 #}
 
-#-------------
-# S3 Bucket
-#-------------
-# resource "random_id" "customer" {
-#   byte_length = 8
-# }
-
-# resource "aws_s3_bucket" "bucket" {
-#     bucket = "nuxeo-${random_id.customer.b64}"
-#     acl = "private"
-
-#   tags {
-#     Name 		= "cloud-${random_id.customer.b64}"
-#     billing-category    = "customers"
-#     billing-subcategory = "${var.stack_name}"
-#     role                = "nuxeo.aws-s3"
-#   }
-# }
-
+#-------------------------------------
+# S3 buckets:w for Nuxeo and for Backups
+#-------------------------------------
 module "s3" {
   source = "./s3/"
   stack_name = "${var.stack_name}"
+  cust_id = "${random_id.customer.b64}"
 }
 
+
+#-------------------------
+# RDS Postgres Database
+#-------------------------
 module "rds" {
   source = "./rds/"
   region = "${var.aws_region}"
@@ -110,9 +72,9 @@ module "rds" {
 }
 
 
-#-------------------
+#-------------------------
 # Elastic Cache Redis
-#-------------------
+#-------------------------
 module "elasticcache" {
 	source = "./elasticcache"
 	cache_name = "${var.stack_name}-redis"
@@ -123,9 +85,9 @@ module "elasticcache" {
 }
 
 
-# #-------------------
+# #-------------------------------
 # # Create Nuxeo Ubuntu Instance
-# #-------------------
+# #-------------------------------
 # # Create a new instance of the latest Ubuntu on an
 # # t2.micro node with an AWS Tag naming it "Nuxeo"
 # data "aws_ami" "ubuntu" {
@@ -154,7 +116,6 @@ module "elasticcache" {
 #     }
 # }
 
-
 # #---------------------
 # # Deployer SSH keys 
 # #--------------------