Skip to content

Commit

Permalink
Reuse existing security group for amazonmq
Browse files Browse the repository at this point in the history
Amazon MQ doesn't support changing the security group associated with an instance
  • Loading branch information
samsimpson1 committed Oct 24, 2024
1 parent 8c41bc9 commit e726fc6
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@
# sg_rabbitmq_elb_id

resource "aws_security_group" "rabbitmq" {
name = "rabbitmq-access"
vpc_id = data.tfe_outputs.vpc.values.id
name = "govuk_rabbitmq_access"
vpc_id = data.tfe_outputs.vpc.nonsensitive_values.id
description = "Access to the rabbitmq host from its ELB"
}

data "aws_security_group" "rabbitmq" {
name = "govuk_rabbitmq_access"
}

import {
to = aws_security_group.rabbitmq
id = data.aws_security_group.rabbitmq.id
}

resource "aws_security_group_rule" "rabbitmq_ingress_rabbitmq_elb_amqp" {
type = "ingress"
from_port = 5672
Expand Down Expand Up @@ -71,7 +80,7 @@ resource "aws_security_group_rule" "rabbitmq_ingress_rabbitmq_epmd" {

resource "aws_security_group" "rabbitmq_elb" {
name = "rabbitmq-elb-access"
vpc_id = data.tfe_outputs.vpc.values.id
vpc_id = data.tfe_outputs.vpc.nonsensitive_values.id
description = "Access the rabbitmq Internal ELB"
}

Expand Down

0 comments on commit e726fc6

Please sign in to comment.