Skip to content

Commit ba9ff4d

Browse files
authored
Merge pull request #38 from HENNGE/general-bug-fixes
Fix issues like missing parameters, typo, incorrect typings, etc
2 parents 435a323 + bbbd05f commit ba9ff4d

File tree

14 files changed

+85
-92
lines changed

14 files changed

+85
-92
lines changed

modules/core/service/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Since this module is the closest to the `resources` form, there are a lot of cus
7070
| <a name="input_platform_version"></a> [platform\_version](#input\_platform\_version) | The platform version on which to run your service. Only applicable for `launch_type` set to `FARGATE`. Defaults to `LATEST`. [AWS Docs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) | `string` | `null` | no |
7171
| <a name="input_propagate_tags"></a> [propagate\_tags](#input\_propagate\_tags) | Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are `SERVICE` and `TASK_DEFINITION`. | `string` | `null` | no |
7272
| <a name="input_scheduling_strategy"></a> [scheduling\_strategy](#input\_scheduling\_strategy) | The scheduling strategy to use for the service. The valid values are `REPLICA` and `DAEMON`. Fargate Tasks do not support `DAEMON` scheduling strategy. | `string` | `null` | no |
73-
| <a name="input_service_connect_configuration"></a> [service\_connect\_configuration](#input\_service\_connect\_configuration) | The ECS Service Connect configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace | <pre>object({<br/> enabled = bool<br/> log_configuration = optional(object({<br/> log_driver = string<br/> options = optional(string)<br/> secret_option = optional(object({<br/> name = string<br/> value_from = string<br/> }))<br/> }))<br/> namespace = optional(string)<br/> service = optional(object({<br/> client_alias = optional(list(object({<br/> dns_name = optional(string)<br/> port = number<br/> })), [])<br/> discovery_name = optional(string)<br/> ingress_port_override = optional(number)<br/> port_name = string<br/> timeout = optional(object({<br/> idle_timeout_seconds = optional(number)<br/> per_request_timeout_seconds = optional(number)<br/> }))<br/> tls = optional(object({<br/> issuer_cert_authority = object({<br/> aws_pca_authority_arn = optional(string)<br/> })<br/> kms_key = optional(string)<br/> role_arn = optional(string)<br/> }))<br/> }))<br/> })</pre> | `null` | no |
73+
| <a name="input_service_connect_configuration"></a> [service\_connect\_configuration](#input\_service\_connect\_configuration) | The ECS Service Connect configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace | <pre>object({<br/> enabled = bool<br/> log_configuration = optional(object({<br/> log_driver = string<br/> options = optional(map(string))<br/> secret_option = optional(object({<br/> name = string<br/> value_from = string<br/> }))<br/> }))<br/> namespace = optional(string)<br/> service = optional(object({<br/> client_alias = optional(list(object({<br/> dns_name = optional(string)<br/> port = number<br/> })), [])<br/> discovery_name = optional(string)<br/> ingress_port_override = optional(number)<br/> port_name = string<br/> timeout = optional(object({<br/> idle_timeout_seconds = optional(number)<br/> per_request_timeout_seconds = optional(number)<br/> }))<br/> tls = optional(object({<br/> issuer_cert_authority = object({<br/> aws_pca_authority_arn = optional(string)<br/> })<br/> kms_key = optional(string)<br/> role_arn = optional(string)<br/> }))<br/> }))<br/> })</pre> | `null` | no |
7474
| <a name="input_service_placement_constraints"></a> [service\_placement\_constraints](#input\_service\_placement\_constraints) | List of map of placement constraints for Service. Max 10. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#placement_constraints) | `list(any)` | `[]` | no |
7575
| <a name="input_service_registry"></a> [service\_registry](#input\_service\_registry) | Map of a service discovery registries for the service. Consists of `registry_arn`, `port`(optional), `container_port`(optional), `container_port`(optional). [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_registries) | `any` | `null` | no |
7676
| <a name="input_tags"></a> [tags](#input\_tags) | Key-value mapping of resource tags | `map(string)` | `{}` | no |
@@ -83,15 +83,15 @@ Since this module is the closest to the `resources` form, there are a lot of cus
8383
| <a name="input_task_memory"></a> [task\_memory](#input\_task\_memory) | Task level Memory units. | `number` | `null` | no |
8484
| <a name="input_task_network_mode"></a> [task\_network\_mode](#input\_task\_network\_mode) | The network mode for container. | `string` | `"bridge"` | no |
8585
| <a name="input_task_pid_mode"></a> [task\_pid\_mode](#input\_task\_pid\_mode) | The process namespace to use for the containers in the task. The valid values are `host` and `task`. | `string` | `null` | no |
86-
| <a name="input_task_placement_constraints"></a> [task\_placement\_constraints](#input\_task\_placement\_constraints) | Placement constraints for Task Definition. List of map. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#placement_constraints) | <pre>object({<br/> expression = optional(string)<br/> type = string<br/> })</pre> | `null` | no |
86+
| <a name="input_task_placement_constraints"></a> [task\_placement\_constraints](#input\_task\_placement\_constraints) | Placement constraints for Task Definition. List of map. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#placement_constraints) | <pre>list(object({<br/> expression = optional(string)<br/> type = string<br/> }))</pre> | `[]` | no |
8787
| <a name="input_task_proxy_configuration"></a> [task\_proxy\_configuration](#input\_task\_proxy\_configuration) | The proxy configuration details for the App Mesh proxy. Defined as map argument. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#proxy_configuration) | `any` | `null` | no |
88-
| <a name="input_task_requires_compatibilites"></a> [task\_requires\_compatibilites](#input\_task\_requires\_compatibilites) | A set of launch types required by the task. The valid values are `EC2` and `FARGATE`. | `list(string)` | <pre>[<br/> "EC2"<br/>]</pre> | no |
88+
| <a name="input_task_requires_compatibilities"></a> [task\_requires\_compatibilities](#input\_task\_requires\_compatibilities) | A set of launch types required by the task. The valid values are `EC2` and `FARGATE`. | `list(string)` | <pre>[<br/> "EC2"<br/>]</pre> | no |
8989
| <a name="input_task_runtime_platform"></a> [task\_runtime\_platform](#input\_task\_runtime\_platform) | Runtime platform (operating system and CPU architecture) that containers may use. Defined as map argument. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#runtime_platform) | `any` | `null` | no |
9090
| <a name="input_task_skip_destroy"></a> [task\_skip\_destroy](#input\_task\_skip\_destroy) | Whether to retain the old revision when the resource is destroyed or replacement is necessary. | `bool` | `false` | no |
9191
| <a name="input_task_track_latest"></a> [task\_track\_latest](#input\_task\_track\_latest) | Whether should track latest ACTIVE task definition on AWS or the one created with the resource stored in state. | `bool` | `false` | no |
9292
| <a name="input_task_volume_configurations"></a> [task\_volume\_configurations](#input\_task\_volume\_configurations) | Volume Block Arguments for Task Definition. List of map. Note that `docker_volume_configuration` should be specified as map argument instead of block. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#volume) | `list(any)` | `[]` | no |
93-
| <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. | <pre>list(object({<br/> name = string<br/> managed_ebs_volume = optional(object({<br/> role_arn = string<br/> encrypted = optional(bool, true)<br/> file_system_type = optional(string)<br/> iops = optional(number)<br/> kms_key_id = optional(string)<br/> size_in_gb = optional(number)<br/> snapshot_id = optional(string)<br/> throughput = optional(number)<br/> volume_type = optional(string)<br/> tag_specifications = optional(list(object({<br/> resource_type = string<br/> propogate_tags = optional(string)<br/> tags = optional(map(string))<br/> })), [])<br/> }))<br/> }))</pre> | `[]` | no |
94-
| <a name="input_vpc_lattice_configurations"></a> [vpc\_lattice\_configurations](#input\_vpc\_lattice\_configurations) | The VPC Lattice configuration for your service that allows Lattice to connect, secure, and monitor your service across multiple accounts and VPCs | <pre>list(object({<br/> role_arn = string<br/> target_group_arn = string<br/> port_name = string<br/> }))</pre> | `null` | no |
93+
| <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. | <pre>list(object({<br/> name = string<br/> managed_ebs_volume = optional(object({<br/> role_arn = string<br/> encrypted = optional(bool, true)<br/> file_system_type = optional(string)<br/> iops = optional(number)<br/> kms_key_id = optional(string)<br/> size_in_gb = optional(number)<br/> snapshot_id = optional(string)<br/> throughput = optional(number)<br/> volume_type = optional(string)<br/> tag_specifications = optional(list(object({<br/> resource_type = string<br/> propagate_tags = optional(string)<br/> tags = optional(map(string))<br/> })), [])<br/> }))<br/> }))</pre> | `[]` | no |
94+
| <a name="input_vpc_lattice_configurations"></a> [vpc\_lattice\_configurations](#input\_vpc\_lattice\_configurations) | The VPC Lattice configuration for your service that allows Lattice to connect, secure, and monitor your service across multiple accounts and VPCs | <pre>list(object({<br/> role_arn = string<br/> target_group_arn = string<br/> port_name = string<br/> }))</pre> | `[]` | no |
9595
| <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 (like aws ecs wait services-stable) before continuing. | `bool` | `null` | no |
9696

9797
## Outputs

modules/core/service/main.tf

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ resource "aws_ecs_service" "main" {
104104
for_each = var.service_connect_configuration == null ? [] : [var.service_connect_configuration]
105105

106106
content {
107-
enabled = service_connect_configuration.value.enalbed
107+
enabled = service_connect_configuration.value.enabled
108108
dynamic "log_configuration" {
109109
for_each = service_connect_configuration.value.log_configuration == null ? [] : [service_connect_configuration.value.log_configuration]
110110

@@ -116,7 +116,7 @@ resource "aws_ecs_service" "main" {
116116

117117
content {
118118
name = secret_option.value.name
119-
value_from = secret_option.value.name
119+
value_from = secret_option.value.value_from
120120
}
121121
}
122122
}
@@ -190,7 +190,7 @@ resource "aws_ecs_service" "main" {
190190

191191
content {
192192
resource_type = tag_specifications.value.resource_type
193-
propagate_tags = tag_specifications.value.propogate_tags
193+
propagate_tags = tag_specifications.value.propagate_tags
194194
tags = tag_specifications.value.tags
195195
}
196196
}
@@ -228,11 +228,13 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
228228
name = var.name
229229
cluster = var.cluster
230230
task_definition = var.create_task_definition ? module.task.arn : var.task_definition_arn
231+
availability_zone_rebalancing = var.availability_zone_rebalancing
231232
deployment_maximum_percent = var.deployment_maximum_percent
232233
deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent
233234
desired_count = var.desired_count
234235
enable_ecs_managed_tags = var.enable_ecs_managed_tags
235236
enable_execute_command = var.enable_execute_command
237+
force_delete = var.force_delete
236238
force_new_deployment = var.force_new_deployment
237239
health_check_grace_period_seconds = var.health_check_grace_period_seconds
238240
iam_role = var.iam_lb_role
@@ -322,7 +324,7 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
322324
for_each = var.service_connect_configuration == null ? [] : [var.service_connect_configuration]
323325

324326
content {
325-
enabled = service_connect_configuration.value.enalbed
327+
enabled = service_connect_configuration.value.enabled
326328
dynamic "log_configuration" {
327329
for_each = service_connect_configuration.value.log_configuration == null ? [] : [service_connect_configuration.value.log_configuration]
328330

@@ -334,7 +336,7 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
334336

335337
content {
336338
name = secret_option.value.name
337-
value_from = secret_option.value.name
339+
value_from = secret_option.value.value_from
338340
}
339341
}
340342
}
@@ -408,7 +410,7 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
408410

409411
content {
410412
resource_type = tag_specifications.value.resource_type
411-
propagate_tags = tag_specifications.value.propogate_tags
413+
propagate_tags = tag_specifications.value.propagate_tags
412414
tags = tag_specifications.value.tags
413415
}
414416
}
@@ -418,7 +420,7 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
418420
}
419421

420422
dynamic "vpc_lattice_configurations" {
421-
for_each = var.vpc_lattice_configurations == null ? [] : [var.vpc_lattice_configurations]
423+
for_each = var.vpc_lattice_configurations
422424
content {
423425
role_arn = vpc_lattice_configurations.value.role_arn
424426
target_group_arn = vpc_lattice_configurations.value.target_group_arn
@@ -430,26 +432,26 @@ resource "aws_ecs_service" "main_ignore_desired_count_changes" {
430432
}
431433

432434
module "task" {
433-
source = "../task"
434-
create_task_definition = var.create_task_definition
435-
name = var.name
436-
container_definitions = var.container_definitions
437-
network_mode = var.task_network_mode
438-
ipc_mode = var.task_ipc_mode
439-
pid_mode = var.task_pid_mode
440-
skip_destroy = var.task_skip_destroy
441-
task_role = var.iam_task_role
442-
daemon_role = var.iam_daemon_role
443-
cpu = var.task_cpu
444-
memory = var.task_memory
445-
enable_fault_injection = var.task_enable_fault_injection
446-
ephemeral_storage = var.task_ephemeral_storage
447-
requires_compatibilites = var.task_requires_compatibilites
448-
volume_configurations = var.task_volume_configurations
449-
placement_constraints = var.task_placement_constraints
450-
inference_accelerator = var.task_inference_accelerator
451-
proxy_configuration = var.task_proxy_configuration
452-
runtime_platform = var.task_runtime_platform
453-
track_latest = var.task_track_latest
454-
tags = var.tags
435+
source = "../task"
436+
create_task_definition = var.create_task_definition
437+
name = var.name
438+
container_definitions = var.container_definitions
439+
network_mode = var.task_network_mode
440+
ipc_mode = var.task_ipc_mode
441+
pid_mode = var.task_pid_mode
442+
skip_destroy = var.task_skip_destroy
443+
task_role = var.iam_task_role
444+
daemon_role = var.iam_daemon_role
445+
cpu = var.task_cpu
446+
memory = var.task_memory
447+
enable_fault_injection = var.task_enable_fault_injection
448+
ephemeral_storage = var.task_ephemeral_storage
449+
requires_compatibilities = var.task_requires_compatibilities
450+
volume_configurations = var.task_volume_configurations
451+
placement_constraints = var.task_placement_constraints
452+
inference_accelerator = var.task_inference_accelerator
453+
proxy_configuration = var.task_proxy_configuration
454+
runtime_platform = var.task_runtime_platform
455+
track_latest = var.task_track_latest
456+
tags = var.tags
455457
}

modules/core/service/variables.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ variable "service_connect_configuration" {
171171
enabled = bool
172172
log_configuration = optional(object({
173173
log_driver = string
174-
options = optional(string)
174+
options = optional(map(string))
175175
secret_option = optional(object({
176176
name = string
177177
value_from = string
@@ -252,11 +252,11 @@ variable "service_placement_constraints" {
252252

253253
variable "task_placement_constraints" {
254254
description = "Placement constraints for Task Definition. List of map. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#placement_constraints)"
255-
default = null
256-
type = object({
255+
default = []
256+
type = list(object({
257257
expression = optional(string)
258258
type = string
259-
})
259+
}))
260260
}
261261

262262
variable "tags" {
@@ -282,7 +282,7 @@ variable "volume_configuration" {
282282
volume_type = optional(string)
283283
tag_specifications = optional(list(object({
284284
resource_type = string
285-
propogate_tags = optional(string)
285+
propagate_tags = optional(string)
286286
tags = optional(map(string))
287287
})), [])
288288
}))
@@ -291,7 +291,7 @@ variable "volume_configuration" {
291291

292292
variable "vpc_lattice_configurations" {
293293
description = "The VPC Lattice configuration for your service that allows Lattice to connect, secure, and monitor your service across multiple accounts and VPCs"
294-
default = null
294+
default = []
295295
type = list(object({
296296
role_arn = string
297297
target_group_arn = string
@@ -354,7 +354,7 @@ variable "task_skip_destroy" {
354354
type = bool
355355
}
356356

357-
variable "task_requires_compatibilites" {
357+
variable "task_requires_compatibilities" {
358358
description = "A set of launch types required by the task. The valid values are `EC2` and `FARGATE`."
359359
default = ["EC2"]
360360
type = list(string)

0 commit comments

Comments
 (0)