Skip to content

Commit 6dba3fe

Browse files
committed
feat: Add variable resource_requirements
The `resource_requirements` variable is supported by the `aws_ecs_task_definition` resource. This allows users to specify the type and amount of resources (like GPUs) to assign to a container.
1 parent 5f276e6 commit 6dba3fe

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ Available targets:
326326
| <a name="input_region"></a> [region](#input\_region) | AWS Region for S3 bucket | `string` | `null` | no |
327327
| <a name="input_repo_name"></a> [repo\_name](#input\_repo\_name) | GitHub repository name of the application to be built and deployed to ECS | `string` | `""` | no |
328328
| <a name="input_repo_owner"></a> [repo\_owner](#input\_repo\_owner) | GitHub Organization or Username | `string` | `""` | no |
329+
| <a name="input_resource_requirements"></a> [resource\_requirements](#input\_resource\_requirements) | The type and amount of a resource to assign to a container. The only supported resource is a GPU. | <pre>list(object({<br/> type = string<br/> value = string<br/> }))</pre> | `null` | no |
329330
| <a name="input_runtime_platform"></a> [runtime\_platform](#input\_runtime\_platform) | Zero or one runtime platform configurations that containers in your task may use.<br/>Map of strings with optional keys `operating_system_family` and `cpu_architecture`.<br/>See `runtime_platform` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#runtime_platform | `list(map(string))` | `[]` | no |
330331
| <a name="input_secrets"></a> [secrets](#input\_secrets) | The secrets to pass to the container. This is a list of maps | <pre>list(object({<br/> name = string<br/> valueFrom = string<br/> }))</pre> | `null` | no |
331332
| <a name="input_service_registries"></a> [service\_registries](#input\_service\_registries) | The service discovery registries for the service. The maximum number of service\_registries blocks is 1. The currently supported service registry is Amazon Route 53 Auto Naming Service - `aws_service_discovery_service`; see `service_registries` docs https://www.terraform.io/docs/providers/aws/r/ecs_service.html#service_registries-1 | <pre>list(object({<br/> registry_arn = string<br/> port = number<br/> container_name = string<br/> container_port = number<br/> }))</pre> | `[]` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
| <a name="input_region"></a> [region](#input\_region) | AWS Region for S3 bucket | `string` | `null` | no |
210210
| <a name="input_repo_name"></a> [repo\_name](#input\_repo\_name) | GitHub repository name of the application to be built and deployed to ECS | `string` | `""` | no |
211211
| <a name="input_repo_owner"></a> [repo\_owner](#input\_repo\_owner) | GitHub Organization or Username | `string` | `""` | no |
212+
| <a name="input_resource_requirements"></a> [resource\_requirements](#input\_resource\_requirements) | The type and amount of a resource to assign to a container. The only supported resource is a GPU. | <pre>list(object({<br/> type = string<br/> value = string<br/> }))</pre> | `null` | no |
212213
| <a name="input_runtime_platform"></a> [runtime\_platform](#input\_runtime\_platform) | Zero or one runtime platform configurations that containers in your task may use.<br/>Map of strings with optional keys `operating_system_family` and `cpu_architecture`.<br/>See `runtime_platform` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#runtime_platform | `list(map(string))` | `[]` | no |
213214
| <a name="input_secrets"></a> [secrets](#input\_secrets) | The secrets to pass to the container. This is a list of maps | <pre>list(object({<br/> name = string<br/> valueFrom = string<br/> }))</pre> | `null` | no |
214215
| <a name="input_service_registries"></a> [service\_registries](#input\_service\_registries) | The service discovery registries for the service. The maximum number of service\_registries blocks is 1. The currently supported service registry is Amazon Route 53 Auto Naming Service - `aws_service_discovery_service`; see `service_registries` docs https://www.terraform.io/docs/providers/aws/r/ecs_service.html#service_registries-1 | <pre>list(object({<br/> registry_arn = string<br/> port = number<br/> container_name = string<br/> container_port = number<br/> }))</pre> | `[]` | no |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ module "container_definition" {
9696
mount_points = var.mount_points
9797
container_depends_on = local.container_depends_on
9898
repository_credentials = var.container_repo_credentials
99+
resource_requirements = var.resource_requirements
99100
linux_parameters = merge(
100101
var.linux_parameters,
101102
var.exec_enabled ? { initProcessEnabled = true } : {}

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ variable "ignore_changes_desired_count" {
150150
default = false
151151
}
152152

153+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ResourceRequirement.html
154+
variable "resource_requirements" {
155+
type = list(object({
156+
type = string
157+
value = string
158+
}))
159+
description = "The type and amount of a resource to assign to a container. The only supported resource is a GPU."
160+
default = null
161+
}
162+
153163
variable "system_controls" {
154164
type = list(map(string))
155165
description = "A list of namespaced kernel parameters to set in the container, mapping to the --sysctl option to docker run. This is a list of maps: { namespace = \"\", value = \"\"}"

0 commit comments

Comments
 (0)