-
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
dynamic block "iterator" argument is not well documented and gives poor feedback when used incorrectly #32432
Comments
Hi @soudaburger, Given which issue you've linked to I assume what you're discussing is the fact that The way the docs for this are supposed to work is in two parts:
The goal then is to avoid bringing up complexity that is only relevant in some very specific legacy cases in the general docs — thereby making the general docs more accessible to the general reader — while still allowing folks who are affected by it to find the relevant documentation. With that principle in mind, I think what we ought to do here is be much more explicit on the Attributes as Blocks page that Instead, I think we should mention much more prominently that Once we have the attributes as blocks page being clear about this, the existing links from provider docs to that page should therefore connect the two so that folks using the affected providers can find the relevant documentation. If there are existing examples of providers using this mode but not documenting it then I would suggest opening a documentation bug in the provider's own repository, since that is where the teams maintain each provider's own documentation. With that said: the issue you linked to is a long one with lots of discussion, and so I may well have totally misunderstood what part of it you were referring to here. If so, it would help if you could link to a specific comment in that discussion or otherwise add some more context so I can understand what part of that discussion you'd like to see reflected in the main documentation. Thanks! (Even if you did have something else in mind here, I think we are missing some clear guidance in the docs about how |
I appreciate the attempt at a reply, but I definitely think you misunderstood what I was intending. Let me try this a different way. The documentation I linked to has references to using
This is where the link to the issue I posted becomes important. Someone (thankfully) at the bottom of that issue references that it should be Example code that throws an error:
Example code that does NOT throw an error:
The ONLY difference is quoting of the Does that help better explain what I'm looking for here? Thanks! |
Thanks for that extra context, @soudaburger! Based on that, I'm guessing you are talking about this comment: #22340 (comment) I'll copy its contents in here just so it's easier to read this issue in future:
It seems like that other issue got confused partway through somehow, since it started off talking about a quirk of "Attributes as Blocks" mode but then in the middle started talking about using Based on this I think there are two things to fix here, the first of which is what I believe you are proposing:
Thanks again! (and as I said in my previous comment, I'm going to open another issue about documenting the fact that |
Much appreciated! |
Terraform Version
Affected Pages
https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks
What is the docs issue?
After finding this issue, it's apparent that nothing will be fixed for the "iterator" "bug". I'm not here to suggest work be done other than show an actual example in the docs to support the use of
iterator
properly, without quotes. This example would have saved me a ton of trial and error and googling. If it wasn't for the one comment to suggest not commenting the iterator value, I would have been stuck. I believe the behavior is counterintuitive, and as such, should definitely have some explicit example in the documentation.Proposal
Just add a formal example of using an
iterator
in a dynamic block.References
#22340
The text was updated successfully, but these errors were encountered: