Chris Mague 5 سال پیش
والد
کامیت
7cf5f7df88
3فایلهای تغییر یافته به همراه31 افزوده شده و 22 حذف شده
  1. 5 5
      maguec1.tfvars
  2. 24 15
      main.tf
  3. 2 2
      variables.tf

+ 5 - 5
maguec1.tfvars

@@ -1,6 +1,6 @@
-region  = "us-west-1"
-profile = "redislabs"
+region    = "us-west-1"
+profile   = "redislabs"
 open-nets = ["76.14.80.208"]
-vpc-azs = ["us-west-1a", "us-west-1c"]
-vpc-cidr = "10.161.0.0/16"
-vpc-name = "maguec1"
+vpc-azs   = ["us-west-1a", "us-west-1c"]
+vpc-cidr  = "10.161.0.0/16"
+vpc-name  = "maguec1"

+ 24 - 15
main.tf

@@ -4,12 +4,13 @@ provider "aws" {
 }
 
 module "vpc" {
-  source     = "../tfmodule-aws-2tier-vpc"
-  region  = var.region
-  profile = var.profile
-  vpc-name   = var.vpc-name
-  vpc-cidr   = var.vpc-cidr
-  vpc-azs    = var.vpc-azs
+  source         = "../tfmodule-aws-2tier-vpc"
+  region         = var.region
+  profile        = var.profile
+  vpc-name       = var.vpc-name
+  vpc-cidr       = var.vpc-cidr
+  vpc-azs        = var.vpc-azs
+  enable-private = false
   common-tags = {
     "Owner"   = "maguec"
     "Project" = "example_terraform"
@@ -17,18 +18,26 @@ module "vpc" {
 }
 
 module "nodes" {
-  source     = "../tfmodule-aws-redis-enterprise"
-  region  = var.region
-  profile = var.profile
-  open-nets = ["76.14.80.208/32"]
+  source          = "../tfmodule-aws-redis-enterprise"
+  region          = var.region
+  profile         = var.profile
+  open-nets       = ["76.14.80.208/32"]
   data-node-count = 3
-  vpc-cidr   = var.vpc-cidr
-  vpc-azs    = var.vpc-azs
-  vpc-name   = var.vpc-name
-  vpc-id = module.vpc.vpc-id
-  vpc-subnets = module.vpc.subnets-public
+  vpc-cidr        = var.vpc-cidr
+  vpc-azs         = var.vpc-azs
+  vpc-name        = var.vpc-name
+  vpc-id          = module.vpc.vpc-id
+  vpc-subnets     = module.vpc.subnets-public
   common-tags = {
     "Owner"   = "maguec"
     "Project" = "example_terraform"
   }
 }
+
+output "node-ips" {
+  value = <<EOT
+  %{ for ip in module.nodes.node-ips ~}
+  ssh -i ~/.ssh/${var.vpc-name}.pem -o IdentitiesOnly=yes  -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${ip}
+  %{ endfor ~}
+  EOT
+}

+ 2 - 2
variables.tf

@@ -12,10 +12,10 @@ variable "vpc-cidr" {
   description = "The CIDR to run the VPC"
 }
 variable "vpc-azs" {
-  type = list
+  type        = list
   description = "The name of the VPC to create"
 }
 variable "open-nets" {
-  type = list
+  type        = list
   description = "Networks that will have full access"
 }