Skip to content

Instantly share code, notes, and snippets.

@jackmahoney
Last active September 25, 2018 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackmahoney/574378b81d5caabf7cde689acf9387c9 to your computer and use it in GitHub Desktop.
Save jackmahoney/574378b81d5caabf7cde689acf9387c9 to your computer and use it in GitHub Desktop.
ecs-cluster-service-task-definition
/*
ecs cluster and service definitions
*/
resource "aws_ecs_cluster" "ecs" {
name = "${var.name}-ecs"
}
/*
define ecs task for this app
*/
data "template_file" "task-definition-template" {
template = "${file("${path.root}/templates/ecs-app.json.tpl")}"
vars {
memory = "${var.memory}"
name = "${var.name}"
region = "${var.region}"
log_group = "${aws_cloudwatch_log_group.ecs-app-logs.name}"
repository_url = "${replace("${aws_ecr_repository.ecr.repository_url}", "https://", "")}"
}
}
resource "aws_ecs_task_definition" "task-definition" {
family = "${var.name}"
container_definitions = "${data.template_file.task-definition-template.rendered}"
}
output "task-definition" {
value = "${data.template_file.task-definition-template.rendered}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment