Skip to content

Commit

Permalink
Added necessary prefixes to resources in autoscaling/hooks/enabled
Browse files Browse the repository at this point in the history
so that multiple concourse clusters can be provisioned in the same aws account.

We need to put prefix to names of iam_role and sqs becase they exist independently to target auto scaling group.
  • Loading branch information
everpeace committed May 26, 2016
1 parent e6796ee commit 5358f0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions autoscaling/hooks/enabled/main.tf
Expand Up @@ -2,11 +2,11 @@
# https://dzone.com/articles/graceful-shutdown-using-aws-autoscaling-groups-and

resource "aws_sqs_queue" "graceful_termination_queue" {
name = "graceful_termination_queue"
name = "${var.prefix}graceful_termination_queue"
}

resource "aws_iam_role" "autoscaling_role" {
name = "autoscaling_role"
name = "${var.prefix}autoscaling_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -65,3 +65,7 @@ output "sqs_queue_arn" {

variable "target_asg_name" {
}

variable "prefix" {

}
3 changes: 2 additions & 1 deletion main.tf
Expand Up @@ -11,6 +11,7 @@ provider "aws" {
module "autoscaling_hooks" {
source = "./autoscaling/hooks/enabled"
target_asg_name = "${aws_autoscaling_group.worker-asg.name}"
prefix = "${var.prefix}"
}

module "autoscaling_schedule" {
Expand Down Expand Up @@ -147,7 +148,7 @@ resource "aws_launch_configuration" "worker-lc" {
create_before_destroy = true
}
}

resource "template_file" "install_concourse" {
template = "${file("${path.module}/00_install_concourse.sh.tpl")}"
}
Expand Down

0 comments on commit 5358f0e

Please sign in to comment.