diff --git a/main.tf b/main.tf index 5e380de7..d08238c3 100644 --- a/main.tf +++ b/main.tf @@ -82,6 +82,7 @@ module "service" { propagate_tags = try(each.value.propagate_tags, null) scheduling_strategy = try(each.value.scheduling_strategy, null) service_connect_configuration = lookup(each.value, "service_connect_configuration", {}) + vpc_lattice_configuration = lookup(each.value, "vpc_lattice_configuration", {}) service_registries = lookup(each.value, "service_registries", {}) timeouts = try(each.value.timeouts, {}) triggers = try(each.value.triggers, {}) diff --git a/modules/service/README.md b/modules/service/README.md index 4faaf8f1..7255c9bc 100644 --- a/modules/service/README.md +++ b/modules/service/README.md @@ -320,6 +320,7 @@ module "ecs_service" { | [timeouts](#input\_timeouts) | Create, update, and delete timeout configurations for the service | `map(string)` | `{}` | no | | [triggers](#input\_triggers) | Map of arbitrary keys and values that, when changed, will trigger an in-place update (redeployment). Useful with `timestamp()` | `any` | `{}` | no | | [volume](#input\_volume) | Configuration block for volumes that containers in your task may use | `any` | `{}` | no | +| [vpc\_lattice\_configuration](#input\_vpc\_lattice\_configuration) | The VPC Lattice configuration for your service that allows Lattice to connect, secure, and monitor your service across multiple accounts and VPCs | `any` | `{}` | no | | [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 | | [wait\_until\_stable](#input\_wait\_until\_stable) | Whether terraform should wait until the task set has reached `STEADY_STATE` | `bool` | `null` | no | | [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 | diff --git a/modules/service/main.tf b/modules/service/main.tf index b7ecef9e..47110b99 100644 --- a/modules/service/main.tf +++ b/modules/service/main.tf @@ -188,6 +188,16 @@ resource "aws_ecs_service" "this" { } } + dynamic "vpc_lattice_configurations" { + for_each = length(var.vpc_lattice_configuration) > 0 ? [var.vpc_lattice_configuration] : [] + + content { + role_arn = try(vpc_lattice_configurations.value.role_arn, null) + target_group_arn = try(vpc_lattice_configurations.value.target_group_arn, null) + port_name = try(vpc_lattice_configurations.value.port_name, null) + } + } + task_definition = local.task_definition triggers = var.triggers wait_for_steady_state = var.wait_for_steady_state diff --git a/modules/service/variables.tf b/modules/service/variables.tf index 9a55e989..0f5e99cb 100644 --- a/modules/service/variables.tf +++ b/modules/service/variables.tf @@ -176,6 +176,12 @@ variable "service_registries" { default = {} } +variable "vpc_lattice_configuration" { + description = "The VPC Lattice configuration for your service that allows Lattice to connect, secure, and monitor your service across multiple accounts and VPCs" + type = any + default = {} +} + variable "timeouts" { description = "Create, update, and delete timeout configurations for the service" type = map(string) diff --git a/wrappers/service/main.tf b/wrappers/service/main.tf index 9a7d6aec..3113a3e7 100644 --- a/wrappers/service/main.tf +++ b/wrappers/service/main.tf @@ -124,6 +124,7 @@ module "wrapper" { timeouts = try(each.value.timeouts, var.defaults.timeouts, {}) triggers = try(each.value.triggers, var.defaults.triggers, {}) volume = try(each.value.volume, var.defaults.volume, {}) + vpc_lattice_configuration = try(each.value.vpc_lattice_configuration, var.defaults.vpc_lattice_configuration, {}) wait_for_steady_state = try(each.value.wait_for_steady_state, var.defaults.wait_for_steady_state, null) wait_until_stable = try(each.value.wait_until_stable, var.defaults.wait_until_stable, null) wait_until_stable_timeout = try(each.value.wait_until_stable_timeout, var.defaults.wait_until_stable_timeout, null)