-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Output when Creating Resource is in lexicographical order #19038
Comments
Hi @vpadronblanco! Thanks for sharing this feedback. As you've seen, in Terraform v0.11 and earlier the data for a resource is represented as a flat dictionary with dot-delimited keys, with lists represented as a set of those keys along with a special In Terraform 0.12 the internal model here is changing to use "real" lists and other collection types, and along with it the rendering of the diff can change to be aware of those structures. I talked more about this and shared a screenshot in an earlier comment on another issue. The new rendering for lists does not explicitly show the indices at all, instead showing the items in order and using diff markers to show which items have been added and removed. Terraform Core produces this diff rendering automatically based on the new value planned by the provider. If you rebuild your provider against the latest commit in Terraform master, which is now tracking towards v0.12 at the time of writing, you may be able to see this for yourself by experimenting with the 0.12-alpha1 releases. There are still several known issues but the basic functionality is functional and should give an impression of the new behavior that we plan to release in v0.12 over the next few months. |
Hello again! We didn't hear back from you, so I'm going to close this in the hope that a previous response gave you the information you needed. If not, please do feel free to re-open this and leave another comment with the information my human friends requested above. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
Hello!
Developing a custom Terraform provider, my colleagues and I have an attribute which is populated by a list. When creating the resource, the output shown of the attribute is being printed in lexicographical(dictionary) order which can be confusing. Can the order be numerical-aware? This can make the list more intuitive to read.
Terraform Version
0.11.8
Terraform Configuration Files
resource "my_custom_provider" "my_custom_resource" {
attribute = ["${split("\n", file("./some_file.txt"))}"]
}
Output
my_custom_provider.my_custom_resource: Creating...
attribute.#: "0" => "68"
attribute.0: "" => "line in document"
attribute.1: "" => "line in document"
attribute.10: "" => "line in document"
attribute.11: "" => "line in document
attribute.12: "" => "line in document"
attribute.13: "" => "line in document"
attribute.14: "" => "line in document"
attribute.15: "" => "line in document"
attribute.16: "" => "line in document"
attribute.17: "" => "line in document"
attribute.18: "" => "line in document"
attribute.19: "" => "line in document"
attribute.2: "" => "line in document"
attribute.20: "" => "line in document"
attribute.21: "" => "line in document"
(...)
attribute.68: "" => "line in document"
other_attribute: "" => ""
my_custom_provider.my_custom_resource: Creation complete after 2s (ID: 01234567-abcd-abcd-abcd-0123456789ab)
Expected Output
attribute.#: "0" => "68"
attribute.0: "" => "line in document"
attribute.1: "" => "line in document"
attribute.2: "" => "line in document"
(...)
attribute.10: "" => "line in document"
attribute.11: "" => "line in document
attribute.12: "" => "line in document"
attribute.13: "" => "line in document"
attribute.14: "" => "line in document"
attribute.15: "" => "line in document"
attribute.16: "" => "line in document"
attribute.17: "" => "line in document"
attribute.18: "" => "line in document"
attribute.19: "" => "line in document"
attribute.20: "" => "line in document"
attribute.21: "" => "line in document"
(...)
attribute.68: "" => "line in document"
other_attribute: "" => ""
my_custom_provider.my_custom_resource: Creation complete after 2s (ID: 01234567-abcd-abcd-abcd-0123456789ab)
Steps to Reproduce
terraform init
terraform apply
The text was updated successfully, but these errors were encountered: