terraform-aws-elastic-beanstalk-environment
terraform-aws-elastic-beanstalk-environment copied to clipboard
Add support for EC2 launch templates
Describe the Feature
Request support be added for EC2 launch templates.
AWS now recommends using EC2 launch templates instead of launch configurations. Currently the terraform-aws-elastic-beanstalk-environment module only supports launch configurations.
References: An AWS Blog post recommending migrating from launch configurations to launch templates: https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/
Documentation for launch configurations warns "We strongly recommend that you do not use launch configurations.": https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html
Documentation for launch templates: https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-templates.html
Thanks.
+1
We're also tracking this issue. This will affect our clients DR plans, as after Dec 2023 there will be no ability to deploy new EB apps with launch configurations to a new AWS account.
The good news in the short term is that by enabling the metadata v2 service, launch templates will be deployed in place of launch configurations.
+ additional_settings = [
+ {
+ namespace = "aws:autoscaling:launchconfiguration",
+ name = "DisableIMDSv1",
+ value = "true"
+ }
+ ]
Hi @ddxor,
Thanks for the DisableIMDSv1 suggestion.
When I add that setting to a pre-existing Beanstalk environment, it switches from launch configurations to launch templates. Which is great. But when I include the setting in an all new environment, I get the following error when applying:
Error: Error creating SSM activation: ValidationException: Nonexistent role or missing ssm service principal in trust policy: arn:aws:iam::XXXXXXXXX:role/XXXXXXX-eb-ec2
After removing the DisableIMDSv1 setting the environment came up successfully. I could then re-add the setting, and the env switched over to launch templates. But that process wouldn't be helpful in a DR scenario after December 2023.
Were you able to bring up a new Beanstalk environment with this setting?
Thanks.
Update: This error was caused by #205, unrelated to the DisableIMDSv1 setting. Thanks.
+1