Can't create beanstalk environment with shared load balancer

I’m trying to create a beanstalk environment pointing to a shared load balancer, which is a new feature recently announced by AWS.

When I attempt to apply my plan, I get this error:

Error: ConfigurationValidationException: Configuration validation exception: Invalid option value: 'default' (Namespace: 'aws:elbv2:listener:80', OptionName: 'Rules'): The load balancer you specified doesn't have a listener on port 80. Specify listener options only for existing listeners.
    status code: 400, request id: 287f9ecd-a41c-46f7-8bc2-63394468fe09

It seems terraform is trying to assign the rule for the target group to the default listener, even though I’m attempting to configure it via HTTPS. If I go and create a listener on port 80 on the load balancer, the terraform plan applies and then assigns the listener rule to the listener on port 80. If I remove the port 80 listener, leaving only the port 443 one, I get the error above.

How can I provision a beanstalk environment that correctly references a shared load balancer that is only configured for HTTPS?

I also having the same issue.

@ raspinall can u share your tf file ?

Would you be able to share your tf file of the alb and eb creates?

I am using these in my module “elastic_beanstalk_environment”, but it is not working

environment_type = “LoadBalanced”
loadbalancer_type = “application”

{
namespace = “aws:elasticbeanstalk:environment”
name = “LoadBalancerIsShared”
value = “true”
},
{
namespace = “aws:elbv2:loadbalancer”
name = “SharedLoadBalancer”
value = module.alb.this_lb_id //from alb creation
},

module.elastic_beanstalk_environment.aws_elastic_beanstalk_environment.default: Creating…

Error: ConfigurationValidationException: Configuration validation exception: Load Balancer AccessLogsS3Bucket setting cannot be applied because AWSEBV2LoadBalancer doesn’t exist.
status code: 400, request id: 862553d3-88c0-4873-897f-781883127066

Hello!
have you solved this issue?
We would like to have the same set up, a shared application load balancer between two beanstalk applications.

Did anyone able to find out how to set up the shared load balancer with Elastic Beanstalk?

Somehow I had the same issue while I was googling and I managed to fix the problem
Weirdly enough, if you leave the AccessLogsS3Enabled there, even if it’s turn to false, I had AWS/Terraform complaining about this missing bucket:

      + setting {
          + name      = "AccessLogsS3Enabled"
          + namespace = "aws:elbv2:loadbalancer"
          + value     = "false"
        }

caused this

│ Error: ConfigurationValidationException: Configuration validation exception: Load Balancer AccessLogsS3Enabled setting cannot be applied because AWSEBV2LoadBalancer doesn't exist.

When using a shared ALB.
Solution: get rid of the namespace, and place it when you need it. AWS ignore the false value somehow