Skip to content

Commit

Permalink
Merge pull request #3 from schubergphilis/sfn-logging-fix
Browse files Browse the repository at this point in the history
fix: log group for state machines
  • Loading branch information
wvanheerde authored Sep 11, 2024
2 parents 432329d + 9687148 commit 70399a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ This module uses the integrated Lambda to abstract some of the more complex func
| [aws_api_gateway_stage.webhooks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_stage) | resource |
| [aws_api_gateway_usage_plan.webhooks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_usage_plan) | resource |
| [aws_api_gateway_usage_plan_key.webhooks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_usage_plan_key) | resource |
| [aws_cloudwatch_log_group.composition_start](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_cloudwatch_log_group.composition_stop](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_cloudwatch_log_group.webhooks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_scheduler_schedule.rds_cluster_backup_start](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule) | resource |
| [aws_scheduler_schedule.rds_cluster_backup_stop](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule) | resource |
Expand Down Expand Up @@ -173,4 +175,4 @@ This module uses the integrated Lambda to abstract some of the more complex func
| <a name="output_start_composition_webhook_url"></a> [start\_composition\_webhook\_url](#output\_start\_composition\_webhook\_url) | n/a |
| <a name="output_stop_composition_webhook_url"></a> [stop\_composition\_webhook\_url](#output\_stop\_composition\_webhook\_url) | n/a |
| <a name="output_webhook_api_key"></a> [webhook\_api\_key](#output\_webhook\_api\_key) | n/a |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
24 changes: 20 additions & 4 deletions step_functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ data "aws_caller_identity" "current" {}

data "aws_region" "current" {}

resource "aws_cloudwatch_log_group" "composition_start" {
name = "sfn-composition-scheduler-start-${var.composition_name}"
kms_key_id = var.kms_key_arn
retention_in_days = 365
tags = var.tags
}

resource "aws_sfn_state_machine" "composition_start" {
#checkov:skip=CKV_AWS_284
name = "composition-scheduler-control-machine-start-${var.composition_name}"
name = "composition-scheduler-start-${var.composition_name}"
role_arn = module.step_functions_role.arn
tags = var.tags

Expand All @@ -56,14 +63,22 @@ resource "aws_sfn_state_machine" "composition_start" {
})

logging_configuration {
level = "ALL"
include_execution_data = true
level = "ALL"
log_destination = "${aws_cloudwatch_log_group.composition_start.arn}:*"
}
}

resource "aws_cloudwatch_log_group" "composition_stop" {
name = "sfn-composition-scheduler-stop-${var.composition_name}"
kms_key_id = var.kms_key_arn
retention_in_days = 365
tags = var.tags
}

resource "aws_sfn_state_machine" "composition_stop" {
#checkov:skip=CKV_AWS_284
name = "composition-scheduler-control-machine-stop-${var.composition_name}"
name = "composition-scheduler-stop-${var.composition_name}"
role_arn = module.step_functions_role.arn
tags = var.tags

Expand All @@ -73,7 +88,8 @@ resource "aws_sfn_state_machine" "composition_stop" {
})

logging_configuration {
level = "ALL"
include_execution_data = true
level = "ALL"
log_destination = "${aws_cloudwatch_log_group.composition_stop.arn}:*"
}
}

0 comments on commit 70399a2

Please sign in to comment.