hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Docs]: aws_sfn_state_machine logging_configuration has incorrect information #37827

Open nimaft opened 4 weeks ago

nimaft commented 4 weeks ago

Documentation Link

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sfn_state_machine#logging_configuration-configuration-block

Description

In documentation, logging_configuration of aws_sfn_state_machine states that logging is only supported by EXPRESS workflows:

The logging_configuration parameter is only valid when type is set to EXPRESS.

This is not true (at least not anymore), standard workflows support logging as well. There are no limitations specified in LoggingConfiguration section of CreateStateMachine. I have also deployed a state machine using below template, and logging was properly configured for a standard workflow:

  name     = "my-state-machine"
  role_arn = "arn:aws:iam::123456789012:role/mystatemachinerole"

  definition = <<EOF
{
  "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
  "StartAt": "HelloWorld",
  "States": {
    "HelloWorld": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:123456789012:myfunction",
      "End": true
    }
  }
}
EOF

  logging_configuration {
    log_destination        = "arn:aws:logs:us-east-1:123456789012:log-group:/aws/statemachine/mystatemachine:*"
    include_execution_data = true
    level                  = "ERROR"
  }
}

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

louis-clotman commented 4 weeks ago

h2. AWS Logging Documentation for Step Functions

When you create a Standard Workflow using the Step Functions console, it will not be configured to enable logging to CloudWatch Logs. An Express Workflow created using the Step Functions console will by default be configured to enable logging to CloudWatch Logs.

For Express workflows, Step Functions can create a role with the necessary AWS Identity and Access Management (IAM) policy for CloudWatch Logs. If you create a Standard Workflow, or an Express Workflow using the API, CLI, or AWS CloudFormation, Step Functions will not enable logging by default, and you will need ensure your role has the necessary permissions.

https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html