Skip to content

Commit

Permalink
Add ephemeral storage support (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktibi authored May 10, 2022
1 parent aceb127 commit 40e4a7f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.71.0
hooks:
- id: terraform_docs
- id: terraform_fmt
Expand Down
2 changes: 2 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ In order to run all checks at any point run the following command:
| <a name="input_entrypoint"></a> [entrypoint](#input\_entrypoint) | The entry point that is passed to the container | `list(string)` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | The environment variables to pass to the container. This is a list of maps. map\_environment overrides environment | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| <a name="input_environment_files"></a> [environment\_files](#input\_environment\_files) | One or more files containing the environment variables to pass to the container. This maps to the --env-file option to docker run. The file must be hosted in Amazon S3. This option is only available to tasks using the EC2 launch type. This is a list of maps | <pre>list(object({<br> value = string<br> type = string<br> }))</pre> | `[]` | no |
| <a name="input_ephemeral_storage_size"></a> [ephemeral\_storage\_size](#input\_ephemeral\_storage\_size) | The number of GBs to provision for ephemeral storage on Fargate tasks. Must be greater than or equal to 21 and less than or equal to 200 | `number` | `0` | no |
| <a name="input_essential"></a> [essential](#input\_essential) | Determines whether all other containers in a task are stopped, if this container fails or stops for any reason. Due to how Terraform type casts booleans in json it is required to double quote this value | `bool` | `true` | no |
| <a name="input_extra_hosts"></a> [extra\_hosts](#input\_extra\_hosts) | A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This is a list of maps | <pre>list(object({<br> ipAddress = string<br> hostname = string<br> }))</pre> | `null` | no |
| <a name="input_firelens_configuration"></a> [firelens\_configuration](#input\_firelens\_configuration) | The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html | <pre>object({<br> type = string<br> options = map(string)<br> })</pre> | `null` | no |
Expand Down
2 changes: 2 additions & 0 deletions examples/multiple-containers/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion examples/test/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ resource "aws_ecs_task_definition" "td" {
type = lookup(proxy_configuration.value, "type", null)
}
}
dynamic "ephemeral_storage" {
for_each = var.ephemeral_storage_size == 0 ? [] : [var.ephemeral_storage_size]
content {
size_in_gib = var.ephemeral_storage_size
}
}
dynamic "volume" {
for_each = var.volumes
content {
Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ variable "proxy_configuration" {
default = []
}

variable "ephemeral_storage_size" {
type = number
description = "The number of GBs to provision for ephemeral storage on Fargate tasks. Must be greater than or equal to 21 and less than or equal to 200"
default = 0

validation {
condition = var.ephemeral_storage_size == 0 || (var.ephemeral_storage_size >= 21 && var.ephemeral_storage_size <= 200)
error_message = "The ephemeral_storage_size value must be inclusively between 21 and 200."
}
}

variable "volumes" {
description = "(Optional) A set of volume blocks that containers in your task may use"
type = list(object({
Expand Down

0 comments on commit 40e4a7f

Please sign in to comment.