-
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
feat(types.mdx): add hint for difference of tuples and lists #35957
base: main
Are you sure you want to change the base?
Conversation
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
@@ -80,6 +80,9 @@ List literals can be split into multiple lines for readability, but always | |||
require a comma between values. A comma after the final value is allowed, | |||
but not required. Values in a list can be arbitrary expressions. | |||
|
|||
Tuples do allow elements to have mixed data types, like `["a", 15, true]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps better to link to the "Type Constraints" page which describes the types in more detail, or at least use the same verbiage to keep things consistent in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for your comment. I opted to directly link the Type Constraints page. Please let me know if I should change the wording
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with a small style suggestion! ✨
@@ -80,6 +80,8 @@ List literals can be split into multiple lines for readability, but always | |||
require a comma between values. A comma after the final value is allowed, | |||
but not required. Values in a list can be arbitrary expressions. | |||
|
|||
List and tuples have differences regarding allowed types. See [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried expanding on this a bit for clarity:
List and tuples have differences regarding allowed types. See [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list) | |
Lists and tuples each have different constraints on the types they allow. For more information on the types that each allows, refer to [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list). |
This PR adds a section to the Types list of the terraform docs. On this page, it wasn't explained on how lists and tuples differ. As seen in the documentation of the
tolist
function, they do clearly have a difference.1.10.x
Draft CHANGELOG entry
ENHANCEMENTS