Chris Mague 5 năm trước cách đây
commit
0077fc9141
7 tập tin đã thay đổi với 83 bổ sung0 xóa
  1. 2 0
      .gitignore
  2. 1 0
      .terraform-version
  3. 18 0
      README.md
  4. 1 0
      inputs.tf
  5. 6 0
      maguec1.tfvars
  6. 34 0
      main.tf
  7. 21 0
      variables.tf

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+.terraform/
+terraform.tfstate*

+ 1 - 0
.terraform-version

@@ -0,0 +1 @@
+0.12.0-beta2

+ 18 - 0
README.md

@@ -0,0 +1,18 @@
+# Example of calling modules to build an RE environment
+
+## Prerequisites
+
+- aws-cli
+- tfenv
+- ansible 
+
+## Generate Key Pair
+
+```
+aws ec2 create-key-pair --profile redislabs --key-name maguec1 --region us-west-1 \
+| jq .KeyMaterial |  awk '{gsub(/\\n/,"\n")}1' | \
+sed -e s/\"//g >> ~/.ssh/maguec1.pem
+
+chmod 0600 ~/.ssh/maguec1.pem
+```
+

+ 1 - 0
inputs.tf

@@ -0,0 +1 @@
+data "aws_caller_identity" "current" {}

+ 6 - 0
maguec1.tfvars

@@ -0,0 +1,6 @@
+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"

+ 34 - 0
main.tf

@@ -0,0 +1,34 @@
+provider "aws" {
+  region  = var.region
+  profile = var.profile
+}
+
+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
+  common-tags = {
+    "Owner"   = "maguec"
+    "Project" = "example_terraform"
+  }
+}
+
+module "nodes" {
+  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 = ["subnet-062902e9bd6b331d3", "subnet-06d9dcca76217c425"]
+  common-tags = {
+    "Owner"   = "maguec"
+    "Project" = "example_terraform"
+  }
+}

+ 21 - 0
variables.tf

@@ -0,0 +1,21 @@
+variable "region" {
+  description = "The Amazon region to run in"
+}
+
+variable "profile" {
+  description = "The Amazon profile to run in"
+}
+variable "vpc-name" {
+  description = "The name of the VPC to create"
+}
+variable "vpc-cidr" {
+  description = "The CIDR to run the VPC"
+}
+variable "vpc-azs" {
+  type = list
+  description = "The name of the VPC to create"
+}
+variable "open-nets" {
+  type = list
+  description = "Networks that will have full access"
+}