Skip to content

Lambda function cannot write logs to Cloudwatch #15

@viyullas

Description

@viyullas
SUMMARY

Probably it has been some change on AWS, because a disclaimer shows asking to add a policy to the execution role used by the Lambda function: AWSLambdaBasicExecutionRole

ISSUE TYPE
  • Bug Report
TERRAFORM VERSION
Terraform v0.14.0
+ provider registry.terraform.io/hashicorp/archive v2.1.0
+ provider registry.terraform.io/hashicorp/aws v3.26.0
+ provider registry.terraform.io/hashicorp/local v2.0.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v3.0.1
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/terraform-providers/mysql v1.9.0

Your version of Terraform is out of date! The latest version
is 0.14.7. You can update by downloading from https://www.terraform.io/downloads.htm
STEPS TO REPRODUCE

If you deploy de terraform module as is a disclaimer appears when you try to see the logs from the lambda funcions page on aws web console

module "start_environment" {
  count                          = local.settings.schedulling_enabled == false ? 0 : 1
  source                         = "diodonfrost/lambda-scheduler-stop-start/aws"
  name                           = "ec2_start"
  cloudwatch_schedule_expression = local.settings.env_start
  aws_regions                    = [local.settings.aws_region]
  schedule_action                = "start"
  autoscaling_schedule           = "true"
  ec2_schedule                   = "true"
  rds_schedule                   = "true"
  resources_tag = {
    key   = "Environment"
    value = terraform.workspace
  }

  tags = local.tags
}
EXPECTED RESULTS

Be able to watch logs

ACTUAL RESULTS

No logs.
If you manually add the role everything works as expected

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions