Skip to content
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

feat: allow task definitions to be used by Fargate #37

Merged
merged 6 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ resource "aws_ecs_task_definition" "ecs_task_definition" {
ipc_mode = var.ipc_mode
network_mode = var.network_mode
pid_mode = var.pid_mode

# Fargate requires cpu and memory to be defined at the task level
cpu = var.cpu
memory = var.memory

dynamic "placement_constraints" {
for_each = var.placement_constraints
content {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/multiple.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"command": null,
"cpu": null,
"cpu": 256,
"disableNetworking": false,
"dnsSearchDomains": null,
"dnsServers": null,
Expand Down Expand Up @@ -42,7 +42,7 @@
},
{
"command": null,
"cpu": null,
"cpu": 256,
"disableNetworking": false,
"dnsSearchDomains": null,
"dnsServers": null,
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/single.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"command": null,
"cpu": null,
"cpu": 256,
"disableNetworking": false,
"dnsSearchDomains": null,
"dnsServers": null,
Expand Down Expand Up @@ -68,7 +68,7 @@
"awslogs-region": "us-east-1"
}
},
"memory": null,
"memory": 512,
"memoryReservation": 512,
"mountPoints": [
{
Expand Down
10 changes: 6 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ variable "command" {
}

variable "cpu" {
default = 0
default = 256
description = "The number of cpu units reserved for the container"
type = number
}

variable "disableNetworking" {
Expand Down Expand Up @@ -95,7 +96,7 @@ variable "interactive" {
}

variable "ipc_mode" {
default = "host"
default = null
description = "The IPC resource namespace to use for the containers in the task"
}

Expand All @@ -118,8 +119,9 @@ variable "logConfiguration" {
}

variable "memory" {
default = 0
default = 512
description = "The hard limit (in MiB) of memory to present to the container"
type = number
}

variable "memoryReservation" {
Expand All @@ -144,7 +146,7 @@ variable "network_mode" {
}

variable "pid_mode" {
default = "host"
default = null
description = "The process namespace to use for the containers in the task"
}

Expand Down