Browse Source

Changes on module ElasticCache, fixing problems with subnet list

Roberto Barbosa 8 years ago
parent
commit
330dede98f
5 changed files with 18 additions and 16 deletions
  1. 4 4
      nuxeo/elasticcache/main.tf
  2. 6 6
      nuxeo/elasticcache/variables.tf
  3. 2 2
      nuxeo/main.tf
  4. 4 2
      nuxeo/rds/variables.tf
  5. 2 2
      nuxeo/s3/main.tf

+ 4 - 4
nuxeo/elasticcache/main.tf

@@ -2,7 +2,7 @@
 # Elastic Cache Redis
 #-------------------
 resource "aws_elasticache_cluster" "redis" {
-  cluster_id            = "${var.cache_name}"
+  cluster_id            = "${var.stack_name}"
   engine                = "redis"
   engine_version       = "${var.engine_version}"
   node_type             = "${var.node_type}"
@@ -15,14 +15,14 @@ resource "aws_elasticache_cluster" "redis" {
   tags {
     Name = "Redis ElasticCache"
     billing-category = "customers"
-    billing-subcategory = "${var.cache_name}"
+    billing-subcategory = "${var.stack_name}"
     role= "nuxeo.redis"
     terraform = "true"
   }
 }
 
 resource "aws_elasticache_subnet_group" "redis" {
-  name        = "${var.cache_name}-redis-subnet-group"
+  name        = "${var.stack_name}-redis-subnet-group"
   description = "Private subnets for the ElastiCache instances"
-  subnet_ids  = ["${subnet_ids}"]
+  subnet_ids  = ["${var.private_subnet_ids}"]
 }

+ 6 - 6
nuxeo/elasticcache/variables.tf

@@ -1,9 +1,5 @@
 // ELASTICCACHE Instance Variables
-
-variable "security_group_ids" {
-}
-
-variable "cache_name" {
+variable "stack_name" {
 }
 
 variable "engine_version" {
@@ -19,6 +15,10 @@ variable "maintenance_window" {
   default = "sun:05:00-sun:06:00"
 }
 
-variable "subnet_ids" {
+variable "private_subnet_ids" {
+		default     = []
 }
 
+variable "security_group_ids" {
+	default     = []
+}

+ 2 - 2
nuxeo/main.tf

@@ -77,11 +77,11 @@ module "rds" {
 #-------------------------
 module "elasticcache" {
 	source = "./elasticcache"
-	cache_name = "${var.stack_name}-redis"
+	stack_name = "${var.stack_name}-redis"
 	engine_version = "3.2.4"
 	node_type = "cache.t2.micro"
 	security_group_ids = ["${module.net.sg_internal_id}"]
-	subnet_ids = ["${element(module.net.db_private, 0)}", "${element(module.net.db_private, 1)}"]
+	private_subnet_ids  = ["${module.net.db_private}"]
 }
 
 

+ 4 - 2
nuxeo/rds/variables.tf

@@ -7,9 +7,11 @@ variable "region" {
 }
 
 variable "security_group_ids" {
+    default     = []
 }
 
 variable "subnet_ids" {
+    default     = []
 }
 
 
@@ -18,7 +20,7 @@ variable "rds_instance_name" {
 }
 
 variable "rds_is_multi_az" {
-    default = "false"
+    default = "true"
 }
 
 variable "rds_storage_type" {
@@ -51,7 +53,7 @@ variable "database_user" {
 }
 
 variable "database_password" {
-	default = "nuxeo"
+	default = "nuxeo2016"
 }
 
 variable "db_parameter_group" {

+ 2 - 2
nuxeo/s3/main.tf

@@ -2,7 +2,7 @@
 # S3 Bucket
 # -------------
 resource "aws_s3_bucket" "bucket" {
-    bucket = "nuxeo-${var.cust_id}"
+    bucket = "nuxeo-${var.stack_name}"
     acl = "private"
 
   tags {
@@ -14,7 +14,7 @@ resource "aws_s3_bucket" "bucket" {
 }
 
 resource "aws_s3_bucket" "bucket_backup" {
-    bucket = "nuxeo-backup-${var.cust_id}"
+    bucket = "nuxeo-backup-${var.stack_name}"
     acl = "private"
 
   tags {