-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
r/aws_sfn_state_machine: validate step-function definition at plan step #39229
r/aws_sfn_state_machine: validate step-function definition at plan step #39229
Conversation
Community NoteVoting for Prioritization
For Submitters
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @kevineor 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccSFNStateMachine_' PKG=sfn ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/sfn/... -v -count 1 -parallel 3 -run=TestAccSFNStateMachine_ -timeout 360m
=== RUN TestAccSFNStateMachine_createUpdate
=== PAUSE TestAccSFNStateMachine_createUpdate
=== RUN TestAccSFNStateMachine_expressUpdate
=== PAUSE TestAccSFNStateMachine_expressUpdate
=== RUN TestAccSFNStateMachine_standardUpdate
=== PAUSE TestAccSFNStateMachine_standardUpdate
=== RUN TestAccSFNStateMachine_nameGenerated
=== PAUSE TestAccSFNStateMachine_nameGenerated
=== RUN TestAccSFNStateMachine_namePrefix
=== PAUSE TestAccSFNStateMachine_namePrefix
=== RUN TestAccSFNStateMachine_publish
=== PAUSE TestAccSFNStateMachine_publish
=== RUN TestAccSFNStateMachine_tags
=== PAUSE TestAccSFNStateMachine_tags
=== RUN TestAccSFNStateMachine_tracing
=== PAUSE TestAccSFNStateMachine_tracing
=== RUN TestAccSFNStateMachine_disappears
=== PAUSE TestAccSFNStateMachine_disappears
=== RUN TestAccSFNStateMachine_expressLogging
=== PAUSE TestAccSFNStateMachine_expressLogging
=== RUN TestAccSFNStateMachine_encryptionConfigurationCustomerManagedKMSKey
--- PASS: TestAccSFNStateMachine_encryptionConfigurationCustomerManagedKMSKey (125.52s)
=== RUN TestAccSFNStateMachine_encryptionConfigurationServiceOwnedKey
--- PASS: TestAccSFNStateMachine_encryptionConfigurationServiceOwnedKey (79.54s)
=== RUN TestAccSFNStateMachine_definitionValidation
=== PAUSE TestAccSFNStateMachine_definitionValidation
=== CONT TestAccSFNStateMachine_createUpdate
=== CONT TestAccSFNStateMachine_disappears
=== CONT TestAccSFNStateMachine_definitionValidation
--- PASS: TestAccSFNStateMachine_definitionValidation (27.25s)
=== CONT TestAccSFNStateMachine_expressLogging
--- PASS: TestAccSFNStateMachine_disappears (82.22s)
=== CONT TestAccSFNStateMachine_namePrefix
--- PASS: TestAccSFNStateMachine_createUpdate (117.24s)
=== CONT TestAccSFNStateMachine_tracing
--- PASS: TestAccSFNStateMachine_expressLogging (92.08s)
=== CONT TestAccSFNStateMachine_tags
--- PASS: TestAccSFNStateMachine_namePrefix (84.27s)
=== CONT TestAccSFNStateMachine_publish
--- PASS: TestAccSFNStateMachine_tracing (94.38s)
=== CONT TestAccSFNStateMachine_standardUpdate
--- PASS: TestAccSFNStateMachine_tags (98.51s)
=== CONT TestAccSFNStateMachine_nameGenerated
--- PASS: TestAccSFNStateMachine_publish (94.23s)
=== CONT TestAccSFNStateMachine_expressUpdate
--- PASS: TestAccSFNStateMachine_nameGenerated (63.98s)
--- PASS: TestAccSFNStateMachine_standardUpdate (92.44s)
--- PASS: TestAccSFNStateMachine_expressUpdate (102.08s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/sfn 572.803s
@kevineor Thanks for the contribution 🎉 👏. |
This functionality has been released in v5.67.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
This PR adds a validation in the plan step for
aws_sfn_state_machine
ressource.This validation uses the newly aws provided API
ValidateStateMachineDefinition
to validate the state machine definition.The validation takes place in the
CustomizeDiff
function and will fail theterraform plan
and output the list of errors or warnings returned by the API.However it does not cover the case where only
WARNING
are returned by the API, as it is not considered as an error.As a result it won't fail or log any warnings.
Improvements to discuss
We could add the possibility to log the warnings returned by the API, but it would require to migrate the ressource to the terraform-plugin-framework.
We would migrate this validation to the
ModifyPlan
step and logging all warnings and errors toresource.ModifyPlanResponse
.Let me know if a such improvement is required.
Relations
Closes #39150
References
https://aws.amazon.com/about-aws/whats-new/2024/08/validation-api-step-functions/?nc1=h_ls
https://docs.aws.amazon.com/step-functions/latest/apireference/API_ValidateStateMachineDefinition.html
Output from Acceptance Testing