Is it possible to set the default listener rule to use HTTPS:443 listener instead of the HTTP:80 listener when creating an ElasticBeanstalk environment with shared load balancing in terraform?
My ALB has port 80 as a listener to redirect traffic from http to https. Right now when beanstalk creates an environment, it creates a listener rule in the HTTP:80 listener which I don't want it to do. In the console I can create an environment with a shared ALB and select the default listener port to be 443(HTTPS) and will create a default rule in the 443 listener instead which is what I want to happen.
I'm building this with terraform and in the general options for ElasticBeanstalk general options, I don't see an option to set the default listener rule to use HTTPS:443 for the elbv2's settings.
After spending too much time on this, the answer was to assign the default rule the :443
listener. I realized it by looking at this AWS doc that specified the default option in the rules block of an ebextension config file - link.
dynamic "setting" {
for_each = var.enable_shared_alb ? [1] : []
content {
namespace = "aws:elbv2:listener:443"
name = "Rules"
# Setting the default value here prevent
# the default rule from being created in the ALB's HTTP:80 listener
# Instead the default rule will be created in the HTTPS:443 listener
value = "default,some-other-rule-name"
}
}