diff --git a/README.md b/README.md
index d65adbcb..d245a0f8 100644
--- a/README.md
+++ b/README.md
@@ -213,13 +213,13 @@ Available targets:
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.14.0 |
-| [aws](#requirement\_aws) | >= 5.37 |
+| [aws](#requirement\_aws) | >= 5.49 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.37 |
+| [aws](#provider\_aws) | >= 5.49 |
## Modules
diff --git a/docs/terraform.md b/docs/terraform.md
index fedbfa94..4682be97 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -4,13 +4,13 @@
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.14.0 |
-| [aws](#requirement\_aws) | >= 5.37 |
+| [aws](#requirement\_aws) | >= 5.49 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 5.37 |
+| [aws](#provider\_aws) | >= 5.49 |
## Modules
diff --git a/examples/complete/fixtures.us-east-2.tfvars b/examples/complete/fixtures.us-east-2.tfvars
index ff5ca66c..035f99b9 100644
--- a/examples/complete/fixtures.us-east-2.tfvars
+++ b/examples/complete/fixtures.us-east-2.tfvars
@@ -67,11 +67,13 @@ container_environment = [
container_port_mappings = [
{
+ name = "http"
containerPort = 80
hostPort = 80
protocol = "tcp"
},
{
+ name = "https"
containerPort = 443
hostPort = 443
protocol = "udp"
@@ -80,3 +82,5 @@ container_port_mappings = [
force_new_deployment = true
redeploy_on_apply = true
+
+service_connect_enabled = true
\ No newline at end of file
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
index d7ae6ff0..21e5a050 100644
--- a/examples/complete/main.tf
+++ b/examples/complete/main.tf
@@ -40,7 +40,7 @@ module "container_definition" {
count = local.enabled ? 1 : 0
source = "cloudposse/ecs-container-definition/aws"
- version = "0.58.2"
+ version = "0.61.1"
container_name = var.container_name
container_image = var.container_image
@@ -76,6 +76,12 @@ module "test_policy" {
context = module.this.context
}
+resource "aws_service_discovery_http_namespace" "default" {
+ count = local.enabled && var.service_connect_enabled ? 1 : 0
+ name = module.this.id
+ tags = module.this.tags
+}
+
module "ecs_alb_service_task" {
source = "../.."
alb_security_group = module.vpc.vpc_default_security_group_id
@@ -101,5 +107,22 @@ module "ecs_alb_service_task" {
task_policy_arns = [module.test_policy.policy_arn]
task_exec_policy_arns_map = { test = module.test_policy.policy_arn }
+ service_connect_configurations = [
+ {
+ enabled = local.enabled && var.service_connect_enabled
+ namespace = join("", aws_service_discovery_http_namespace.default[*].arn)
+ service = [{
+ client_alias = [{
+ dns_name = module.this.name
+ port = 80
+ }
+ ]
+ discovery_name = module.this.name
+ port_name = var.container_port_mappings[0].name
+ }
+ ]
+ }
+ ]
+
context = module.this.context
-}
+}
\ No newline at end of file
diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf
index 421514d1..a7883ead 100644
--- a/examples/complete/variables.tf
+++ b/examples/complete/variables.tf
@@ -43,6 +43,8 @@ variable "container_port_mappings" {
containerPort = number
hostPort = number
protocol = string
+ name = optional(string)
+ appProtocol = optional(string)
}))
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort"
@@ -137,4 +139,13 @@ variable "redeploy_on_apply" {
type = bool
description = "Updates the service to the latest task definition on each apply"
default = false
+}
+
+variable "service_connect_enabled" {
+ type = bool
+ description = <