Last active
February 16, 2016 20:30
-
-
Save elblivion/e767aa9a697fe426b6c7 to your computer and use it in GitHub Desktop.
ECS service module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "myapp" { | |
source = "modules/myapp_service" | |
environment = "${var.environment}" | |
ecs_cluster_id = "${module.ecs_cluster.cluster_id}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "ecs_cluster_id" {} | |
variable "environment" {} | |
variable "count" { default = 1 } | |
variable "console_tag" { default = "latest" } | |
variable "hub_tag" { default = "latest" } | |
variable "registry" { default = "<our-id>.dkr.ecr.us-east-1.amazonaws.com" } | |
resource "template_file" "containers" { | |
template = "${path.module}/containers/myaapp.json.tpl" | |
vars = { | |
registry = "${var.registry}" | |
console_tag = "${var.console_tag}" | |
hub_tag = "${var.hub_tag}" | |
} | |
} | |
resource "aws_ecs_task_definition" "myapp" { | |
family = "myapp-${var.environment}" | |
container_definitions = "${template_file.containers.rendered}" | |
} | |
resource "aws_ecs_service" "myapp" { | |
name = "myapp-${var.environment}" | |
cluster = "${var.ecs_cluster_id}" | |
task_definition = "${aws_ecs_task_definition.myapp.arn}" | |
desired_count = "${var.count}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment