-
-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ECS cluster #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things and we can merge it as 0.0.1
examples/complete-ecs/main.tf
Outdated
@@ -0,0 +1,58 @@ | |||
provider "aws" { | |||
region = "eu-west-1" | |||
version = "v1.18.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to specify version
here, because we need to be able to run examples using latest automatically.
outputs.tf
Outdated
@@ -0,0 +1,3 @@ | |||
output "ecs_cluster_id" { | |||
value = "${aws_ecs_cluster.ecs.0.id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a replacement to concat
when create_ecs = false
?
@@ -0,0 +1,7 @@ | |||
# ECS instance policy | |||
|
|||
For an EC2 instance to connect it self to ECS it needs rights to do so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itself
main.tf
Outdated
version = ">= 1.0.0" | ||
} | ||
|
||
resource "aws_ecs_cluster" "ecs" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ecs"
=> "this"
EOF | ||
} | ||
|
||
resource "aws_ecs_service" "hello-world" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use snake case for resource's names everywhere
examples/complete-ecs/main.tf
Outdated
} | ||
|
||
#----- ECS Resources-------- | ||
module "ec2" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be simplified by using autoscaling
module directly here instead of wrapper module (ec2
)
examples/complete-ecs/main.tf
Outdated
|
||
module "vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
version = "v1.30.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pin version here. We need to stay on the edge with examples to be able to see that this still works (yes, we lack automated tests for modules).
examples/complete-ecs/main.tf
Outdated
provider "terraform" {} | ||
|
||
locals { | ||
name = "my-ecs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually pass values similar to the name of the example to be able to have several examples at once - complete-ecs
in this case.
# ... omitted | ||
} | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a section Examples
to describe each kind of example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor naming comments before merge
@@ -0,0 +1,3 @@ | |||
output "instance_profile_id" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it this_iam_instance_profile_id
outputs.tf
Outdated
@@ -0,0 +1,3 @@ | |||
output "ecs_cluster_id" { | |||
value = "${element(concat(aws_ecs_cluster.this.*.id, list("")), 0)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name this this_ecs_cluster_id
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Initial ECS setup (no Fargate)
This should be enough for version 0.0.1, from here on we can extend the module and the example as shown in the TODO in the example readme.