You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both validation and plan runs as expected, but during the apply operation a TF error is returned:
module.ecs_alb_service_task.aws_ecs_service.ignore_changes_task_definition[0]: Creating...
╷
│ Error: error creating ECS service (mcoins-sandbox-analytics-denormalizer): InvalidParameterException: Load Balancer Name can not be blank.
│
│ with module.ecs_alb_service_task.aws_ecs_service.ignore_changes_task_definition[0],
│ on .terraform/modules/ecs_alb_service_task/main.tf line 351, in resource "aws_ecs_service""ignore_changes_task_definition":
│ 351: resource "aws_ecs_service""ignore_changes_task_definition" {
│
╵
Which means I'm sending an empty string to AWS API and causing the issue. This led me to try getting rid of the elb_name value, and getting this other error:
│ Error: Invalid value for input variable
│
│ on main.tf line 110, in module "ecs_alb_service_task":
│ 110: ecs_load_balancers = local.alb
│
│ The given value is not suitable for
│ module.ecs_alb_service_task.var.ecs_load_balancers declared at
│ .terraform/modules/ecs_alb_service_task/variables.tf:11,1-30: element 0:
│ attribute "elb_name" is required.
I've looked into AWS API documentation and Terraform Provider and make sure that only container_port and container_name are required arguments so you can choose between classic ELB or ALB/NLB.
I suggest the option here is to add the optional keyword to both elb_name and target_group_arn arguments, so whenever values are supplied here it's not mandatory to supply both. I can also supply a PR with the suggested change if you're ok with it.
Expected Behavior
Terraform should be able to apply with either Classic or ALB/NLB values, but not require both.
Steps to Reproduce
Steps to reproduce the behavior:
Run an example that supplies ecs_load_balancers value with either classic ELB name or ALB target group ARN.
Run terraform init && terraform apply
Screenshots
Code snippets and errors above
Environment (please complete the following information):
Hi @kunalsawhney, since my use case was very specific and not likely to use classic LB I decided to fork on this repo and simplify the configuration to only expect ALB connectivity. I know this is not flexible nor the most ideal solution, but it was enough for me to move forward. I think for now this issue can be closed.
Describe the Bug
I am trying to provision an ECS service + ECS task using an ALB. To configure the options for load balancer, I am using this configuration:
Such local configuration goes directly to the module input like so:
Both validation and plan runs as expected, but during the apply operation a TF error is returned:
Which means I'm sending an empty string to AWS API and causing the issue. This led me to try getting rid of the elb_name value, and getting this other error:
I've looked into AWS API documentation and Terraform Provider and make sure that only
container_port
andcontainer_name
are required arguments so you can choose between classic ELB or ALB/NLB.I suggest the option here is to add the
optional
keyword to bothelb_name
andtarget_group_arn
arguments, so whenever values are supplied here it's not mandatory to supply both. I can also supply a PR with the suggested change if you're ok with it.Expected Behavior
Terraform should be able to apply with either Classic or ALB/NLB values, but not require both.
Steps to Reproduce
Steps to reproduce the behavior:
ecs_load_balancers
value with either classic ELB name or ALB target group ARN.terraform init && terraform apply
Screenshots
Code snippets and errors above
Environment (please complete the following information):
Additional Context
None.
The text was updated successfully, but these errors were encountered: