-
Notifications
You must be signed in to change notification settings - Fork 4
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
Attempting conversion containing for_each
with primitives fails
#228
Comments
@brandonpollack23 Would love it if you could take a look at this. Sounds like it could be impactful for the customer @smithrobs is working with! |
Taking a look! |
Alright so just a heads up on a few things: If the variables are not defined in the TF (I assume they are and just ommitted here) then that causes some trouble since our converter doesnt know what the references are to. Another issue is we've done a bunch of work getting conversions more robust recently but Let me try to see how it handles this case and then I'll see if there are any other things we need to do to get this working and I'll report back shortly |
Alright so the good news is the "try" we have implemented seems to cover this case pretty well (usually this kind of count is 0 or 1 pattern works fine, it's when you need to do .apply that we get hairy). But there is some kind of typing error on the variable member we're trying to loop on so Ill spend a bit more time on it and see if its a quick fix |
Ok after mulling on this a while I have a hunch: This type is mistaken as a number, it is assigned as a number, did we actually mean to use the dynamic value of the inner block? I'm trying it out. It works when I assign just a static block (just one) so perhaps this is it. Edit: Specifically the error occurs first in the inner for loop where "entry.value.abortIncompleteMultipartUploadDays" is being bound digging a bit deeper when scope traversing this expression, entry traverses just fine, but value's type here isn't that of an object but instead a UnionType of either 0 or 1 constant. This leads to the solution (which in hindsight should have been obvious looking at the PCL...):
|
So to summarize:
Once these are all fixed this should work. To give you a little timeline: I'm looking at (2) now, (1) is my next major task and hopefully we have it done in a few weeks. (3) can probably be mixed in between (or will be fixed incidentally by the continuing work). |
This was causing names that needed to be accessible to be shadowed, resulting in failed PCL binding after conversion see #228 Fixes pulumi/pulumi#18718
This was causing names that needed to be accessible to be shadowed, resulting in failed PCL binding after conversion see #228 Fixes pulumi/pulumi#18718
This was causing names that needed to be accessible to be shadowed, resulting in failed PCL binding after conversion see #228 Fixes pulumi/pulumi#18718
What happened?
The
pulumi convert --from terraform --language python
command does not work for terraform for-loops that have primitives. For examplefor_each = var.enable ? [1] : []
which we typically do for dynamic blocks such as S3 lifecycle rules which has to be defined in a single resource (ref). The error message is:Example
Output of
pulumi about
Not available; assume v3.141.0
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: