Ordered output for Terraform resources with 'count' #77
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.
Hey,
First of, thanks for the tool! It makes using Ansible with Terraform very convenient.
This PR sorts the output groups that correlate to Terraform resources created with
count
.As an example, check this old generated inventory. The
kafka
list is not ordered a in the same manner as it is in Terraform.After this PR, the output of
kafka
list will be in proper order:As an aside, it will print to standard error when a key is overwritten during resource gathering. The tool has an issue, where resources of different types will overwrite others with the same name. Also, having tags with same value as the name of a resource will overwrite the old value. As it is not solvable in a backwards compatible manner, I decided to just print this out so the users will at least see the errors.