[Help needed] New Resource: aws_ssm_document_list #1088
Closed
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.
Adding
aws_ssm_document_list
. This based onaws_ssm_document
, but allows a list of documents to be passed in.Use Case
The use case for this is when dealing with many of these documents, instead of creating a
ssm_document
for every document, it's easier to get a list of documents from a folder.Previously, I was using the powershell below to retrieve this list, and passing that to
ssm_document
as a list variable. This works initially, but has a few issues:And passing that output to a module as a variable:
aws_ssm_document_list
Using
aws_ssm_document_list
with datasource_template_file_list, I can write this:The
Create
action takes all documents in the list and creates them in AWS, using partial state.The
Update
action takes care of Creating / Updating / Deleting new and existing documents that get added or removed from the folder. It also takes care of avoiding making changes to documents that haven't changed (from the statefile re-ordering issue above)The
Delete
action takes all documents in the list and deletes them from AWS, using partial state.Todo / Help
rs.Primary.Attributes["documents_list"]
?ssm_document
, because I couldn't find a way to get a*schema.ResourceData
type object fromd.Get("documents_list")
. Is that possible a different way?