d/aws_sfn_state_machines: Add data source for listing all State Machines #34519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a data source for listing all State Machines in Step Functions.
This can be combined with the
data.aws_sfn_state_machine
data source to get detailed information about each resource via thearns
andnames
attributes in a for_each loop.I tried following the skaff-procedure as detailed in https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/add-a-new-datasource.md but couldn't find any reference implementations from services I already know about/use, so I decided to follow the code used in e.g. the RDS Clusters data source instead.
I've tested overriding the provider locally and I got the expected output, but I'll try to provide the acceptance tests as well.
Relations
References
Output from Acceptance Testing
I was not able to add acceptance tests because I'm not quite sure how to ensure a resource exists while testing a data source only, and looking at the singular
data.aws_sfn_state_machine
it seemed like that just expects 1 to exist, which doesn't work when I try the same. If you have any pointers on how to add acceptance tests for a data source fetching multiple items I'd love that, but I'll keep playing around to try to get them done. :)