I am creating a new AWS Beanstalk environment with Terrraform.
AWS Console gives you the ability to turn on CloudWatch logs streaming for Beanstalk environments in the config (see image below), however looking at the providerI cannot find terraform currently allowing to do that.
I find this feature quite useful, has anyone stumbled upon this before?
You need to use option settings for Elastic Beanstalk [1]:
resource "aws_elastic_beanstalk_environment" "some_env" {
name = "some-env-name"
application = aws_elastic_beanstalk_application.app.name
solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
setting {
namespace = "aws:elasticbeanstalk:cloudwatch:logs"
name = "StreamLogs"
value = "true"
}
setting {
namespace = "aws:elasticbeanstalk:cloudwatch:logs"
name = "RetentionInDays"
value = "7"
}
setting {
namespace = "aws:elasticbeanstalk:cloudwatch:logs"
name = "DeleteOnTerminate"
value = "false"
}
}
Note that I have given an example for the name
, application
and solution_stack_name
as you have not provided any code in your question. Additionally, keep in mind that DeleteOnTerminate
will keep the logs for the RetentionInDays
.