Skip to content

Commit 0b9ee11

Browse files
committed
feat(modules/cluster): service connect configuration
1 parent 12ec1ed commit 0b9ee11

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ No resources.
4949
| <a name="input_asg_tags"></a> [asg\_tags](#input\_asg\_tags) | Resources Tags for Autoscaling group | `map(string)` | `{}` | no |
5050
| <a name="input_asg_vpc_zone_identifier"></a> [asg\_vpc\_zone\_identifier](#input\_asg\_vpc\_zone\_identifier) | (Optional) List of subnet IDs to launch resources in. | `list(string)` | n/a | yes |
5151
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | (Required) Name of the cluster | `string` | n/a | yes |
52+
| <a name="input_cluster_service_connect_namespace"></a> [cluster\_service\_connect\_namespace](#input\_cluster\_service\_connect\_namespace) | (Required) ARN of the aws\_service\_discovery\_http\_namespace that's used when you create a service and don't specify a Service Connect configuration. | `string` | `null` | no |
5253
| <a name="input_cluster_setting"></a> [cluster\_setting](#input\_cluster\_setting) | (Optional) Configuration block(s) with cluster settings. | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
5354
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | (Optional) Key-value map of resource tags. | `map(string)` | `{}` | no |
5455

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
module "cluster" {
66
source = "./modules/cluster"
77

8-
name = var.cluster_name
9-
setting = var.cluster_setting
10-
tags = var.cluster_tags
8+
name = var.cluster_name
9+
service_connect_namespace = var.cluster_service_connect_namespace
10+
setting = var.cluster_setting
11+
tags = var.cluster_tags
1112
}
1213

1314
################################################################################

modules/cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ No modules.
2929
| Name | Description | Type | Default | Required |
3030
|------|-------------|------|---------|:--------:|
3131
| <a name="input_name"></a> [name](#input\_name) | Name of the ECS Cluster to create | `string` | n/a | yes |
32+
| <a name="input_service_connect_namespace"></a> [service\_connect\_namespace](#input\_service\_connect\_namespace) | (Required) ARN of the aws\_service\_discovery\_http\_namespace that's used when you create a service and don't specify a Service Connect configuration. | `string` | `null` | no |
3233
| <a name="input_setting"></a> [setting](#input\_setting) | Details of the setting configuration | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
3334
| <a name="input_tags"></a> [tags](#input\_tags) | Resource Tags for ECS Cluster | `map(any)` | `{}` | no |
3435

modules/cluster/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ resource "aws_ecs_cluster" "this" {
77
}
88
}
99

10+
dynamic "service_connect_defaults" {
11+
for_each = var.service_connect_namespace != null ? [1] : []
12+
13+
content {
14+
namespace = var.service_connect_namespace
15+
}
16+
}
17+
1018
dynamic "setting" {
1119
for_each = var.setting
1220
iterator = setting

modules/cluster/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ variable "name" {
33
type = string
44
}
55

6+
variable "service_connect_namespace" {
7+
description = "(Required) ARN of the aws_service_discovery_http_namespace that's used when you create a service and don't specify a Service Connect configuration."
8+
type = string
9+
default = null
10+
}
11+
612
variable "setting" {
713
description = "Details of the setting configuration"
814
type = list(object({

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ variable "cluster_name" {
33
type = string
44
}
55

6+
variable "cluster_service_connect_namespace" {
7+
description = "(Required) ARN of the aws_service_discovery_http_namespace that's used when you create a service and don't specify a Service Connect configuration."
8+
type = string
9+
default = null
10+
}
11+
612
variable "cluster_setting" {
713
description = "(Optional) Configuration block(s) with cluster settings."
814
type = list(object({

0 commit comments

Comments
 (0)