Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
krotkiewicz committed Jul 14, 2017
1 parent 3d627e2 commit 762e2d0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.tfstate.backup
*.tfvars
*.lock.info
.terraform
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<REGION-HERE>"
access_key = "<YOUR-KEY-HERE>"
secret_key = "<YOUR-SECRET-HERE>"
ssh_key_name = "<SSH-KEY-NAME>"
vpc_id = "<VPC-ID>"
subnet_ids = ["<SUBNET-1-ID>", "<SUBNET-2-ID>"]
count = 3
subnet_ids = ["<SUBNET-ID-1>", "<SUBNET-ID-2>"]
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.
Expand Down
40 changes: 40 additions & 0 deletions example/main.tf
Original file line number Diff line number Diff line change
@@ -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}"
}

0 comments on commit 762e2d0

Please sign in to comment.