Skip to content

Commit

Permalink
add placement_constraint_on_demand_only variable
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed Jan 17, 2024
1 parent 269391f commit 85f5d72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ END
name = 'data'
host_path = '/mnt/data'
}
}
placement_constraint_on_demand_only = true
```

## API
Expand All @@ -39,6 +39,7 @@ END
* `container_definitions` - list of strings. Each string should be a JSON document describing a single container definition - see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html.
* `policy` - An IAM policy to control the task's access to AWS services - see http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html
* `volume` - Volume block map with 'name' and 'host_path'. See https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume for more info.
* `placement_constraint_on_demand_only` - Will restrict the taks to run only on on-demand container instances avoiding running on spot instances.

### Outputs

Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ locals {

module "task_definition" {
source = "mergermarket/ecs-task-definition/acuris"
version = "2.1.0"
version = "2.2.0"
family = var.family
container_definitions = var.container_definitions
task_role_arn = aws_iam_role.task_role.arn
execution_role_arn = aws_iam_role.ecs_tasks_execution_role.arn
network_mode = var.network_mode
volume = var.volume
placement_constraint_on_demand_only = var.placement_constraint_on_demand_only
}

resource "aws_iam_role_policy" "role_policy" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ variable "network_mode" {
description = "The Docker networking mode to use for the containers in the task"
type = string
default = "bridge"
}

variable "placement_constraint_on_demand_only" {
description = "Add placement constraint to only run on on-demand instances"
type = bool
default = false
}

0 comments on commit 85f5d72

Please sign in to comment.