From 762e2d08cbe9236d5c8be663311850748d8d79ff Mon Sep 17 00:00:00 2001 From: Konrad Rotkiewicz Date: Fri, 14 Jul 2017 07:36:18 +0200 Subject: [PATCH] add example --- .gitignore | 1 + README.md | 14 ++++++++++---- example/main.tf | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 example/main.tf diff --git a/.gitignore b/.gitignore index 815ebba..89835fb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.tfstate.backup *.tfvars *.lock.info +.terraform diff --git a/README.md b/README.md index 562ed25..9e994bb 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,24 @@ ## How to use it ? -Create `terraform.tfvars` file with content: +Clone the repo, go to `example` directory, create `terraform.tfvars` file with content: ``` region = "" access_key = "" secret_key = "" ssh_key_name = "" vpc_id = "" -subnet_ids = ["", ""] -count = 3 +subnet_ids = ["", ""] +ssh_security_group_ids = [] +elb_security_group_ids = [] + +rabbitmq_admin_password = "example-password" +rabbitmq_admin_password = "example-password" +rabbitmq_secret_cookie = "example-secret-cookie" +rabbitmq_node_count = 3 ``` -then run `terraform plan` and `terraform apply` +then run `terraform get`, `terraform plan` and `terraform apply`. Are 3 node not enough ? Update `count` to `5` and run `terraform apply` again, it will update Autoscaling Group and add `2` nodes more. Dead simple. diff --git a/example/main.tf b/example/main.tf new file mode 100644 index 0000000..072ffee --- /dev/null +++ b/example/main.tf @@ -0,0 +1,40 @@ +variable "access_key" {} +variable "secret_key" {} +variable "region" {} + +variable "vpc_id" {} +variable "ssh_key_name" {} +variable "subnet_ids" { + type = "list" +} +variable "ssh_security_group_ids" { + type = "list" +} +variable "elb_security_group_ids" { + type = "list" +} + +variable "rabbitmq_admin_password" {} +variable "rabbitmq_rabbit_password" {} +variable "rabbitmq_secret_cookie" {} +variable "rabbitmq_node_count" {} + +provider "aws" { + region = "${var.region}" + access_key = "${var.access_key}" + secret_key = "${var.secret_key}" +} + +module "rabbitmq" { + source = "github.com/ulamlabs/rabbitmq-cluster" + region = "${var.region}" + vpc_id = "${var.vpc_id}" + ssh_key_name = "${var.ssh_key_name}" + subnet_ids = "${var.subnet_ids}" + ssh_security_group_ids = "${var.ssh_security_group_ids}" + elb_security_group_ids = "${var.elb_security_group_ids}" + admin_password = "${var.rabbitmq_admin_password}" + rabbit_password = "${var.rabbitmq_rabbit_password}" + rabbitmq_secret_cookie = "${var.rabbitmq_secret_cookie}" + count = "${var.rabbitmq_node_count}" +}