config generation: escape map keys with whitespace#35754
Conversation
|
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
|
I guess my experiment over in #34823 would've unintentionally fixed this due to That other (more-ambitious-than-necessary) PR aside, it might be interesting to note that |
|
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 contributions. |
This PR updates the config generation package so map keys with whitespace are escaped with quotes. This is already handled automatically for the normal attribute generation, and nested blocks are also escaped by default. This PR updates the nested attributes so the keys of nested maps are validated and escaped if necessary. It is only maps that have this problem, attributes in objects cannot contain whitespace and other types (lists, sets, tuples) do not render keys anyway.
The rendering package has this same problem, and so far we've not handled it perfectly but just well enough. We'll continue to do so here, but the code calls out we could modify the HCL library so it exposes the internal functions it uses to detect when escaping is necessary and share those between HCL and Terraform. But so far, we've not had any need to take this too seriously.
Fixes #35752
Target Release
1.9.x
Draft CHANGELOG entry
BUG FIXES