Skip to content

Commit 5f25125

Browse files
feat: Add support for EBS volumes (#205)
* feat: Adding support for EBS volumes * feat: Adding support for EBS volumes * feat: Add support for EBS volumes * feat: Add support for EBS volumes * chore: Update min required AWS provider version --------- Co-authored-by: Bryant Biggs <[email protected]>
1 parent 5253dc1 commit 5f25125

28 files changed

+318
-92
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ module "ecs" {
160160
| Name | Version |
161161
|------|---------|
162162
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
163-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
163+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
164164

165165
## Providers
166166

examples/complete/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
2727
| Name | Version |
2828
|------|---------|
2929
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
30-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
30+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
3131

3232
## Providers
3333

3434
| Name | Version |
3535
|------|---------|
36-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
36+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
3737

3838
## Modules
3939

examples/complete/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37"
7+
version = ">= 5.59"
88
}
99
}
1010
}

examples/ec2-autoscaling/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
2727
| Name | Version |
2828
|------|---------|
2929
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
30-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
30+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
3131

3232
## Providers
3333

3434
| Name | Version |
3535
|------|---------|
36-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
36+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
3737

3838
## Modules
3939

@@ -73,6 +73,8 @@ No inputs.
7373
| <a name="output_service_iam_role_name"></a> [service\_iam\_role\_name](#output\_service\_iam\_role\_name) | Service IAM role name |
7474
| <a name="output_service_iam_role_unique_id"></a> [service\_iam\_role\_unique\_id](#output\_service\_iam\_role\_unique\_id) | Stable and unique string identifying the service IAM role |
7575
| <a name="output_service_id"></a> [service\_id](#output\_service\_id) | ARN that identifies the service |
76+
| <a name="output_service_infrastructure_iam_role_arn"></a> [service\_infrastructure\_iam\_role\_arn](#output\_service\_infrastructure\_iam\_role\_arn) | Infrastructure IAM role ARN |
77+
| <a name="output_service_infrastructure_iam_role_name"></a> [service\_infrastructure\_iam\_role\_name](#output\_service\_infrastructure\_iam\_role\_name) | Infrastructure IAM role name |
7678
| <a name="output_service_name"></a> [service\_name](#output\_service\_name) | Name of the service |
7779
| <a name="output_service_task_definition_arn"></a> [service\_task\_definition\_arn](#output\_service\_task\_definition\_arn) | Full ARN of the Task Definition (including both `family` and `revision`) |
7880
| <a name="output_service_task_definition_revision"></a> [service\_task\_definition\_revision](#output\_service\_task\_definition\_revision) | Revision of the task in a particular family |

examples/ec2-autoscaling/main.tf

+21-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,24 @@ module "ecs_service" {
9595
}
9696
}
9797

98+
create_infrastructure_iam_role = true
99+
volume_configuration = {
100+
ebs-volume = {
101+
managed_ebs_volume = {
102+
encrypted = true
103+
file_system_type = "xfs"
104+
size_in_gb = 5
105+
volume_type = "gp3"
106+
}
107+
}
108+
}
109+
98110
volume = {
99-
my-vol = {}
111+
my-vol = {},
112+
ebs-volume = {
113+
name = "ebs-volume"
114+
configure_at_launch = true
115+
}
100116
}
101117

102118
# Container definition(s)
@@ -115,6 +131,10 @@ module "ecs_service" {
115131
{
116132
sourceVolume = "my-vol",
117133
containerPath = "/var/www/my-vol"
134+
},
135+
{
136+
containerPath = "/ebs/data"
137+
sourceVolume = "ebs-volume"
118138
}
119139
]
120140

examples/ec2-autoscaling/outputs.tf

+10
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,13 @@ output "service_autoscaling_scheduled_actions" {
130130
description = "Map of autoscaling scheduled actions and their attributes"
131131
value = module.ecs_service.autoscaling_scheduled_actions
132132
}
133+
134+
output "service_infrastructure_iam_role_arn" {
135+
description = "Infrastructure IAM role ARN"
136+
value = module.ecs_service.infrastructure_iam_role_arn
137+
}
138+
139+
output "service_infrastructure_iam_role_name" {
140+
description = "Infrastructure IAM role name"
141+
value = module.ecs_service.infrastructure_iam_role_name
142+
}

examples/ec2-autoscaling/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37"
7+
version = ">= 5.59"
88
}
99
}
1010
}

examples/fargate/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
2727
| Name | Version |
2828
|------|---------|
2929
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
30-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
30+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
3131

3232
## Providers
3333

3434
| Name | Version |
3535
|------|---------|
36-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
36+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
3737

3838
## Modules
3939

examples/fargate/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37"
7+
version = ">= 5.59"
88
}
99
}
1010
}

modules/cluster/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ module "ecs_cluster" {
137137
| Name | Version |
138138
|------|---------|
139139
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
140-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
140+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
141141

142142
## Providers
143143

144144
| Name | Version |
145145
|------|---------|
146-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
146+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
147147

148148
## Modules
149149

modules/cluster/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37"
7+
version = ">= 5.59"
88
}
99
}
1010
}

modules/container-definition/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ module "example_ecs_container_definition" {
116116
| Name | Version |
117117
|------|---------|
118118
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
119-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
119+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
120120

121121
## Providers
122122

123123
| Name | Version |
124124
|------|---------|
125-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
125+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
126126

127127
## Modules
128128

modules/container-definition/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37"
7+
version = ">= 5.59"
88
}
99
}
1010
}

modules/service/README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ module "ecs_service" {
167167
| Name | Version |
168168
|------|---------|
169169
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
170-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37 |
170+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.59 |
171171

172172
## Providers
173173

174174
| Name | Version |
175175
|------|---------|
176-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37 |
176+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.59 |
177177

178178
## Modules
179179

@@ -195,10 +195,12 @@ module "ecs_service" {
195195
| [aws_ecs_task_set.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_set) | resource |
196196
| [aws_iam_policy.service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
197197
| [aws_iam_policy.task_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
198+
| [aws_iam_role.infrastructure_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
198199
| [aws_iam_role.service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
199200
| [aws_iam_role.task_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
200201
| [aws_iam_role.tasks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
201202
| [aws_iam_role_policy.tasks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
203+
| [aws_iam_role_policy_attachment.infrastructure_iam_role_ebs_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
202204
| [aws_iam_role_policy_attachment.service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
203205
| [aws_iam_role_policy_attachment.task_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
204206
| [aws_iam_role_policy_attachment.task_exec_additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
@@ -207,6 +209,7 @@ module "ecs_service" {
207209
| [aws_security_group_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
208210
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
209211
| [aws_ecs_task_definition.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_task_definition) | data source |
212+
| [aws_iam_policy_document.infrastructure_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
210213
| [aws_iam_policy_document.service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
211214
| [aws_iam_policy_document.service_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
212215
| [aws_iam_policy_document.task_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
@@ -234,6 +237,7 @@ module "ecs_service" {
234237
| <a name="input_cpu"></a> [cpu](#input\_cpu) | Number of cpu units used by the task. If the `requires_compatibilities` is `FARGATE` this field is required | `number` | `1024` | no |
235238
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
236239
| <a name="input_create_iam_role"></a> [create\_iam\_role](#input\_create\_iam\_role) | Determines whether the ECS service IAM role should be created | `bool` | `true` | no |
240+
| <a name="input_create_infrastructure_iam_role"></a> [create\_infrastructure\_iam\_role](#input\_create\_infrastructure\_iam\_role) | Determines whether the ECS infrastructure IAM role should be created | `bool` | `false` | no |
237241
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Determines if a security group is created | `bool` | `true` | no |
238242
| <a name="input_create_service"></a> [create\_service](#input\_create\_service) | Determines whether service resource will be created (set to `false` in case you want to create task definition only) | `bool` | `true` | no |
239243
| <a name="input_create_task_definition"></a> [create\_task\_definition](#input\_create\_task\_definition) | Determines whether to create a task definition or use existing/provided | `bool` | `true` | no |
@@ -264,6 +268,13 @@ module "ecs_service" {
264268
| <a name="input_iam_role_use_name_prefix"></a> [iam\_role\_use\_name\_prefix](#input\_iam\_role\_use\_name\_prefix) | Determines whether the IAM role name (`iam_role_name`) is used as a prefix | `bool` | `true` | no |
265269
| <a name="input_ignore_task_definition_changes"></a> [ignore\_task\_definition\_changes](#input\_ignore\_task\_definition\_changes) | Whether changes to service `task_definition` changes should be ignored | `bool` | `false` | no |
266270
| <a name="input_inference_accelerator"></a> [inference\_accelerator](#input\_inference\_accelerator) | Configuration block(s) with Inference Accelerators settings | `any` | `{}` | no |
271+
| <a name="input_infrastructure_iam_role_arn"></a> [infrastructure\_iam\_role\_arn](#input\_infrastructure\_iam\_role\_arn) | Existing IAM role ARN | `string` | `null` | no |
272+
| <a name="input_infrastructure_iam_role_description"></a> [infrastructure\_iam\_role\_description](#input\_infrastructure\_iam\_role\_description) | Description of the role | `string` | `null` | no |
273+
| <a name="input_infrastructure_iam_role_name"></a> [infrastructure\_iam\_role\_name](#input\_infrastructure\_iam\_role\_name) | Name to use on IAM role created | `string` | `null` | no |
274+
| <a name="input_infrastructure_iam_role_path"></a> [infrastructure\_iam\_role\_path](#input\_infrastructure\_iam\_role\_path) | IAM role path | `string` | `null` | no |
275+
| <a name="input_infrastructure_iam_role_permissions_boundary"></a> [infrastructure\_iam\_role\_permissions\_boundary](#input\_infrastructure\_iam\_role\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the IAM role | `string` | `null` | no |
276+
| <a name="input_infrastructure_iam_role_tags"></a> [infrastructure\_iam\_role\_tags](#input\_infrastructure\_iam\_role\_tags) | A map of additional tags to add to the IAM role created | `map(string)` | `{}` | no |
277+
| <a name="input_infrastructure_iam_role_use_name_prefix"></a> [infrastructure\_iam\_role\_use\_name\_prefix](#input\_infrastructure\_iam\_role\_use\_name\_prefix) | Determines whether the IAM role name (`iam_role_name`) is used as a prefix | `bool` | `true` | no |
267278
| <a name="input_ipc_mode"></a> [ipc\_mode](#input\_ipc\_mode) | IPC resource namespace to be used for the containers in the task The valid values are `host`, `task`, and `none` | `string` | `null` | no |
268279
| <a name="input_launch_type"></a> [launch\_type](#input\_launch\_type) | Launch type on which to run your service. The valid values are `EC2`, `FARGATE`, and `EXTERNAL`. Defaults to `FARGATE` | `string` | `"FARGATE"` | no |
269280
| <a name="input_load_balancer"></a> [load\_balancer](#input\_load\_balancer) | Configuration block for load balancers | `any` | `{}` | no |
@@ -319,6 +330,7 @@ module "ecs_service" {
319330
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | Create, update, and delete timeout configurations for the service | `map(string)` | `{}` | no |
320331
| <a name="input_triggers"></a> [triggers](#input\_triggers) | Map of arbitrary keys and values that, when changed, will trigger an in-place update (redeployment). Useful with `timestamp()` | `any` | `{}` | no |
321332
| <a name="input_volume"></a> [volume](#input\_volume) | Configuration block for volumes that containers in your task may use | `any` | `{}` | no |
333+
| <a name="input_volume_configuration"></a> [volume\_configuration](#input\_volume\_configuration) | Configuration for a volume specified in the task definition as a volume that is configured at launch time. Currently, the only supported volume type is an Amazon EBS volume | `any` | `{}` | no |
322334
| <a name="input_wait_for_steady_state"></a> [wait\_for\_steady\_state](#input\_wait\_for\_steady\_state) | If true, Terraform will wait for the service to reach a steady state before continuing. Default is `false` | `bool` | `null` | no |
323335
| <a name="input_wait_until_stable"></a> [wait\_until\_stable](#input\_wait\_until\_stable) | Whether terraform should wait until the task set has reached `STEADY_STATE` | `bool` | `null` | no |
324336
| <a name="input_wait_until_stable_timeout"></a> [wait\_until\_stable\_timeout](#input\_wait\_until\_stable\_timeout) | Wait timeout for task set to reach `STEADY_STATE`. Valid time units include `ns`, `us` (or µs), `ms`, `s`, `m`, and `h`. Default `10m` | `string` | `null` | no |
@@ -334,6 +346,8 @@ module "ecs_service" {
334346
| <a name="output_iam_role_name"></a> [iam\_role\_name](#output\_iam\_role\_name) | Service IAM role name |
335347
| <a name="output_iam_role_unique_id"></a> [iam\_role\_unique\_id](#output\_iam\_role\_unique\_id) | Stable and unique string identifying the service IAM role |
336348
| <a name="output_id"></a> [id](#output\_id) | ARN that identifies the service |
349+
| <a name="output_infrastructure_iam_role_arn"></a> [infrastructure\_iam\_role\_arn](#output\_infrastructure\_iam\_role\_arn) | Infrastructure IAM role ARN |
350+
| <a name="output_infrastructure_iam_role_name"></a> [infrastructure\_iam\_role\_name](#output\_infrastructure\_iam\_role\_name) | Infrastructure IAM role name |
337351
| <a name="output_name"></a> [name](#output\_name) | Name of the service |
338352
| <a name="output_security_group_arn"></a> [security\_group\_arn](#output\_security\_group\_arn) | Amazon Resource Name (ARN) of the security group |
339353
| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | ID of the security group |

0 commit comments

Comments
 (0)