Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sfn/state_machine] fix logging_configuration #39947

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kuredev
Copy link
Contributor

@kuredev kuredev commented Oct 30, 2024

According to AWS specifications, the default is set to OFF if not specified https://docs.aws.amazon.com/step-functions/latest/apireference/API_CreateStateMachine.html

Description

In the aws_sfn_state_machine resource, if logging_configuration is specified but level is not, applying it once succeeds, but trying to apply it again results in a failure.

logging_configuration {
  include_execution_data = false
}

This is likely because, in AWS, the default value for level is "OFF," so "OFF" is recorded in the deployed environment and tfstate. However, since no default value was set in the Terraform provider, it is mistakenly detected as a change.

~ logging_configuration {
  - level                  = "OFF" -> null
	# (2 unchanged attributes hidden)
}

https://docs.aws.amazon.com/step-functions/latest/apireference/API_CreateStateMachine.html

Therefore, I set a default value for level in the schema of the Terraform provider. After testing, I confirmed that no changes are detected upon reapplying.

Relations

Closes #34697

References

Output from Acceptance Testing

make testacc PKG=sfn TESTS='TestAccSFNStateMachine_expressLogging'
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sfn/... -v -count 1 -parallel 20 -run='TestAccSFNStateMachine_expressLogging'  -timeout 360m
2024/10/31 11:12:33 Initializing Terraform AWS Provider...
=== RUN   TestAccSFNStateMachine_expressLogging
=== PAUSE TestAccSFNStateMachine_expressLogging
=== CONT  TestAccSFNStateMachine_expressLogging
--- PASS: TestAccSFNStateMachine_expressLogging (101.32s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sfn        101.441s

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added the service/sfn Issues and PRs that pertain to the sfn service. label Oct 30, 2024
@kuredev kuredev changed the title set default log level to 'OFF.' [sfn/state_machine] set default log level to 'OFF.' Oct 30, 2024
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 30, 2024
@kuredev kuredev force-pushed the b-fix-state_machine-log_level_default branch from ea25067 to 7fb2fbc Compare October 31, 2024 02:24
@kuredev kuredev marked this pull request as ready for review October 31, 2024 02:29
@kuredev kuredev requested a review from a team as a code owner October 31, 2024 02:29
@kuredev kuredev changed the title [sfn/state_machine] set default log level to 'OFF.' [sfn/state_machine] fix logging_configuration Oct 31, 2024
@kuredev kuredev force-pushed the b-fix-state_machine-log_level_default branch from 7fb2fbc to cecc60b Compare October 31, 2024 02:36
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/sfn Issues and PRs that pertain to the sfn service.
Projects
None yet
2 participants