Skip to content

Commit

Permalink
Updates to allow for multiple calls to the modules
Browse files Browse the repository at this point in the history
basicly, this works now

```hcl

module "ecs-cluster" {
  source       = "./terraform-ecs-cluster"
  name         = "infra-services"
  servers      = 1
  subnet_id    = "subnet-6e101446"
  vpc_id       = "vpc-99e73dfc"
}

module "ecs-cluster2" {
  source       = "./terraform-ecs-cluster"
  name         = "infra-services2"
  servers      = 1
  subnet_id    = "subnet-6e101446"
  vpc_id       = "vpc-99e73dfc"
}
```
  • Loading branch information
tfhartmann committed Sep 1, 2016
1 parent 8c3a200 commit e1c2aaa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions iam.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resource "aws_iam_instance_profile" "ecs_profile" {
name = "ecs_test_profile"
name = "tf-created-AmazonECSContainerProfile-${var.name}"
roles = ["${aws_iam_role.ecs-role.name}"]
}

resource "aws_iam_role" "ecs-role" {
name = "tf-created-AmazonECSContainerInstanceRole"
name = "tf-created-AmazonECSContainerInstanceRole-${var.name}"

assume_role_policy = <<EOF
{
Expand All @@ -25,7 +25,7 @@ EOF
}

resource "aws_iam_policy" "ecs-policy" {
name = "tf-created-AmazonECSContainerInstancePolicy"
name = "tf-created-AmazonECSContainerInstancePolicy-${var.name}"
description = "A terraform created policy for ECS"
policy = <<EOF
{
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ EOF

#Instance tags
tags {
Name = "${var.cluster_name} ${var.tagName}-${count.index}"
Name = "${var.name} ${var.tagName}-${count.index}"
}
}

resource "aws_security_group" "ecs" {
name = "ecs-sg"
name = "ecs-sg-${var.name}"
description = "Container Instance Allowed Ports"
vpc_id = "${var.vpc_id}"
ingress {
Expand All @@ -48,5 +48,5 @@ resource "aws_security_group" "ecs" {

# Make this a var that an get passed in?
resource "aws_ecs_cluster" "cluster" {
name = "${var.cluster_name}"
name = "${var.name}"
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "ami" {
}
}

variable "cluster_name" {
variable "name" {
description = "AWS ECS Cluster Name"
}
variable "key_name" {
Expand Down

0 comments on commit e1c2aaa

Please sign in to comment.