More easier setting ecs task to connect alb-rules and cloudwatch
the "aws_alb_target_group" was created same resource when setting multiple "https_listener_rules" on 1.3.2. there is sample for duplicate resources.
{
"module": "module.service.module.mvb-core-api",
"mode": "managed",
"type": "aws_alb_target_group",
"name": "this",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{...},
{...} // <--- should not been created
]
},you can run "terraform state pull > state.json" to check state file if it has duplicate resources.

terraform state list module.service | grep "aws_alb_target_group.this\[1\]"
## and remove unnecessary resource
terraform state rm 'module.service.module.mvb-core-auth.aws_alb_target_group.this[1]'| Name | Version |
|---|---|
| terraform | >= 1.0 |
| aws | >= 5.31 |
| Name | Version |
|---|---|
| aws | 5.31.0 |
No modules.
| Name | Type |
|---|---|
| aws_alb_target_group.this | resource |
| aws_cloudwatch_log_group.customize_naming | resource |
| aws_cloudwatch_log_group.this | resource |
| aws_ecs_service.this | resource |
| aws_ecs_task_definition.this | resource |
| aws_lb_listener_rule.rule | resource |
| aws_ecs_task_definition.this | data source |
| aws_region.current | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| alias | n/a | string |
null |
no |
| auto_generate_cw_group_key | n/a | string |
"cloudwatchGroupName" |
no |
| capacity_provider_strategy | n/a | list(any) |
[] |
no |
| cs_id | n/a | string |
n/a | yes |
| deployment_maximum_percent | ecs maximun healthy percent | number |
200 |
no |
| deployment_minimum_healthy_percent | ecs minimum healthy percent | number |
100 |
no |
| deregistration_delay | ALB deregister delay time | number |
30 |
no |
| desired_count | task number | number |
1 |
no |
| ecs_service_name | n/a | string |
null |
no |
| ecs_task_name | n/a | string |
null |
no |
| env | n/a | string |
n/a | yes |
| fargate | n/a | any |
{ |
no |
| health_check | Health checks for Target Group | map(any) |
{ |
no |
| https_listener_rules | A list of maps describing the Listener Rules for this ALB. Required key/values: actions, conditions. Optional key/values: priority, https_listener_index (default to https_listeners[count.index]) | any |
[] |
no |
| is_default_tg | n/a | bool |
false |
no |
| is_log | container auto aws driver with log | bool |
true |
no |
| launch_type | n/a | string |
"EC2" |
no |
| lb_stickiness | n/a | any |
null |
no |
| listener_arn | n/a | string |
"" |
no |
| load_balancing_algorithm_type | alb algorithm | string |
"round_robin" |
no |
| mapping_port | n/a | number |
0 |
no |
| name | n/a | string |
n/a | yes |
| network_configuration | n/a | any |
null |
no |
| network_mode | n/a | string |
null |
no |
| ordered_placement_strategy | ecs container order strategy | map(string) |
{ |
no |
| placement_constraints | ecs container constraints | map(string) |
{} |
no |
| priority | n/a | number |
1 |
no |
| retention_in_days | task number | number |
14 |
no |
| scheduling_strategy | ecs scheduling strategy. The valid values are REPLICA and DAEMON | string |
"REPLICA" |
no |
| 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 | any |
{} |
no |
| service_registries | service discovery | map(string) |
{} |
no |
| tags | n/a | map(string) |
{ |
no |
| target_group_name | n/a | string |
null |
no |
| task_def | n/a | any |
n/a | yes |
| task_exec_iam_role_arn | Existing IAM role ARN | string |
null |
no |
| tasks_iam_role_arn | Existing IAM role ARN | string |
null |
no |
| volume | n/a | any |
null |
no |
| vpc_id | n/a | string |
n/a | yes |
No outputs.