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
CodePudding user response:
I believe you would just create your own cloudwatch log streams via the provider for cloudwatch.
This feature could just be using the cloudwatch API in order to create these, but present the option in the Elastic beanstalk interface for ease of use.
CodePudding user response:
You need to use option settings for Elastic Beanstalk [1]:
resource "aws_elastic_beanstalk_environment" "tfenvtest" {
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
.