Skip to content

Commit

Permalink
feat: add volume def
Browse files Browse the repository at this point in the history
  • Loading branch information
angle319 committed Apr 25, 2024
1 parent 246f3a1 commit c6e6a01
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ No modules.
| <a name="input_service_registries"></a> [service\_registries](#input\_service\_registries) | service discovery | `map(string)` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(string)` | <pre>{<br> "provision": "terraform"<br>}</pre> | no |
| <a name="input_task_def"></a> [task\_def](#input\_task\_def) | n/a | `any` | n/a | yes |
| <a name="input_volume"></a> [volume](#input\_volume) | n/a | `any` | `null` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | n/a | `string` | n/a | yes |

## Outputs
Expand Down
23 changes: 23 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@ resource "aws_ecs_task_definition" "this" {
}
}
})])

dynamic "volume" {
for_each = (var.volume == null) ? [] : [var.volume]

content {
dynamic "docker_volume_configuration" {
for_each = (try(volume.value.docker_volume_configuration, null) == null) ? [] : [volume.value.docker_volume_configuration]
content {
autoprovision = try(docker_volume_configuration.value.autoprovision, null)
driver_opts = try(docker_volume_configuration.value.driver_opts, null)
driver = try(docker_volume_configuration.value.driver, null)
labels = try(docker_volume_configuration.value.labels, null)
scope = try(docker_volume_configuration.value.scope, null)
}
}
//TODO efs_volume_configuration
//TODO fsx_windows_file_server_volume_configuration
# efs_volume_configuration = try(volume.value.efs_volume_configuration, null)
# fsx_windows_file_server_volume_configuration = try(volume.value.fsx_windows_file_server_volume_configuration,null)
host_path = try(volume.value.host_path, null)
name = volume.value.name
}
}
tags = merge({
author = "Angle Wang"
}, local.tags, {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ variable "task_def" {
type = any
}

variable "volume" {
type = any
default = null
}

variable "priority" {
type = number
default = 1
Expand Down

0 comments on commit c6e6a01

Please sign in to comment.