Skip to content

Commit 762e2d0

Browse files
committed
add example
1 parent 3d627e2 commit 762e2d0

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.tfstate.backup
33
*.tfvars
44
*.lock.info
5+
.terraform

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,24 @@
1717

1818
## How to use it ?
1919

20-
Create `terraform.tfvars` file with content:
20+
Clone the repo, go to `example` directory, create `terraform.tfvars` file with content:
2121
```
2222
region = "<REGION-HERE>"
2323
access_key = "<YOUR-KEY-HERE>"
2424
secret_key = "<YOUR-SECRET-HERE>"
2525
ssh_key_name = "<SSH-KEY-NAME>"
2626
vpc_id = "<VPC-ID>"
27-
subnet_ids = ["<SUBNET-1-ID>", "<SUBNET-2-ID>"]
28-
count = 3
27+
subnet_ids = ["<SUBNET-ID-1>", "<SUBNET-ID-2>"]
28+
ssh_security_group_ids = []
29+
elb_security_group_ids = []
30+
31+
rabbitmq_admin_password = "example-password"
32+
rabbitmq_admin_password = "example-password"
33+
rabbitmq_secret_cookie = "example-secret-cookie"
34+
rabbitmq_node_count = 3
2935
```
3036

31-
then run `terraform plan` and `terraform apply`
37+
then run `terraform get`, `terraform plan` and `terraform apply`.
3238

3339
Are 3 node not enough ? Update `count` to `5` and run `terraform apply` again,
3440
it will update Autoscaling Group and add `2` nodes more. Dead simple.

example/main.tf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
variable "access_key" {}
2+
variable "secret_key" {}
3+
variable "region" {}
4+
5+
variable "vpc_id" {}
6+
variable "ssh_key_name" {}
7+
variable "subnet_ids" {
8+
type = "list"
9+
}
10+
variable "ssh_security_group_ids" {
11+
type = "list"
12+
}
13+
variable "elb_security_group_ids" {
14+
type = "list"
15+
}
16+
17+
variable "rabbitmq_admin_password" {}
18+
variable "rabbitmq_rabbit_password" {}
19+
variable "rabbitmq_secret_cookie" {}
20+
variable "rabbitmq_node_count" {}
21+
22+
provider "aws" {
23+
region = "${var.region}"
24+
access_key = "${var.access_key}"
25+
secret_key = "${var.secret_key}"
26+
}
27+
28+
module "rabbitmq" {
29+
source = "github.com/ulamlabs/rabbitmq-cluster"
30+
region = "${var.region}"
31+
vpc_id = "${var.vpc_id}"
32+
ssh_key_name = "${var.ssh_key_name}"
33+
subnet_ids = "${var.subnet_ids}"
34+
ssh_security_group_ids = "${var.ssh_security_group_ids}"
35+
elb_security_group_ids = "${var.elb_security_group_ids}"
36+
admin_password = "${var.rabbitmq_admin_password}"
37+
rabbit_password = "${var.rabbitmq_rabbit_password}"
38+
rabbitmq_secret_cookie = "${var.rabbitmq_secret_cookie}"
39+
count = "${var.rabbitmq_node_count}"
40+
}

0 commit comments

Comments
 (0)