File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed
Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 1- provider "aws" {
2- region = " ${ var . region } "
3- access_key = " ${ var . access_key } "
4- secret_key = " ${ var . secret_key } "
5- }
6-
71data "aws_vpc" "vpc" {
82 id = " ${ var . vpc_id } "
93}
@@ -83,14 +77,14 @@ resource "aws_security_group" "rabbitmq_elb" {
8377 protocol = " tcp"
8478 from_port = 5672
8579 to_port = 5672
86- security_groups = [" ${ var . security_group_ids } " ]
80+ security_groups = [" ${ var . elb_security_group_ids } " ]
8781 }
8882
8983 ingress {
9084 protocol = " tcp"
9185 from_port = 80
9286 to_port = 80
93- security_groups = [" ${ var . security_group_ids } " ]
87+ security_groups = [" ${ var . elb_security_group_ids } " ]
9488 }
9589
9690 egress {
@@ -135,7 +129,7 @@ resource "aws_security_group" "rabbitmq_nodes" {
135129 protocol = " tcp"
136130 from_port = 22
137131 to_port = 22
138- security_groups = [" ${ var . security_group_ids } " ]
132+ security_groups = [" ${ var . ssh_security_group_ids } " ]
139133 }
140134
141135 egress {
@@ -172,7 +166,13 @@ resource "aws_autoscaling_group" "rabbitmq" {
172166 force_delete = true
173167 launch_configuration = " ${ aws_launch_configuration . rabbitmq . name } "
174168 load_balancers = [" ${ aws_elb . elb . name } " ]
175- vpc_zone_identifier = " ${ var . subnet_ids } "
169+ vpc_zone_identifier = [" ${ var . subnet_ids } " ]
170+
171+ tag {
172+ key = " Name"
173+ value = " rabbitmq"
174+ propagate_at_launch = true
175+ }
176176}
177177
178178resource "aws_elb" "elb" {
Original file line number Diff line number Diff line change 1+ output "rabbitmq_elb_dns" {
2+ value = " ${ aws_elb . elb . dns_name } "
3+ }
Original file line number Diff line number Diff line change 1- variable "access_key" {}
2- variable "secret_key" {}
3- variable "region" {}
41variable "vpc_id" {}
2+ variable "region" {}
53variable "ssh_key_name" {}
64variable "count" {
75 description = " Number of RabbitMQ nodes"
@@ -11,8 +9,12 @@ variable "subnet_ids" {
119 description = " Subnets for RabbitMQ nodes"
1210 type = " list"
1311}
14- variable "security_group_ids" {
15- description = " Security groups which should have access to ELB (amqp + http ports) and nodes (ssh port)"
12+ variable "ssh_security_group_ids" {
13+ description = " Security groups which should have SSH access to nodes."
14+ type = " list"
15+ }
16+ variable "elb_security_group_ids" {
17+ description = " Security groups which should have access to ELB (amqp + http ports)."
1618 type = " list"
1719}
1820variable "admin_password" {
You can’t perform that action at this time.
0 commit comments