I have a weird issue and I don’t know if this goes...
# python
d
I have a weird issue and I don’t know if this goes in #aws, here, or elsewhere but here goes. I built a stack in python that mimics what we currently do with Cloudformation to deploy a Fargate app, reusing outputs from a base networking Cloudformation stack that provides VPC, subnets, load balancers, listeners, DNS zone etc… I built it using a combination of
aws
and
aws-native
providers, preferring the native one where available and working. it works fine, outperforms cloudformation as expected I then moved that exact same code into a new file and wrapped it in
class MyCustomFargateApp(pulumi.ComponentResource):
I passed `opts=pulumi.ResourceOptions(parent=self)`everywhere, and that’s all the changes I did when I tried to deploy it, I got this error:
Copy code
Diagnostics:
  pulumi:providers:aws-native (default_5_7_0):
    error: no resource plugin 'pulumi-resource-aws-native' found in the workspace at version v5.7.0 or on your $PATH, install the plugin using `pulumi plugin install resource aws-native v5.7.0`
which makes no sense because
aws-native
is in v0.18.0 and it’s
aws
that’s v5.7.0 to debug: • I nuked venv and
__pycache__
• I changed the name of the stack in Pulumi.yaml • I removed both providers using
pulumi plugin rm resource aws
etc the results are the same I did the same steps with the working stack without a ComponentResource, it deploys fine from scratch I repeated the same steps with my broken stack but I commented out *every resource*… it deploys fine, just shows an empty MyCustomFargateApp resource. swell. I then proceeded to remove comments from resources one by one. working fine: • pulumi_aws.route53.Record • pulumi_aws.iam.Role • pulumi_aws_native.logs.LogGroup • pulumi_aws_native.ecs.TaskDefinition • pulumi_aws.lb.TargetGroup it blows up when I uncomment the pulumi_aws_native.elasticloadbalancingv2.ListenerRule it does reference the TargetGroup which comes from aws-classic… but exact same stuff works if not wrapped in a ComponentResource please advise, I’m losing my mind
g
Hmm... While I'm digging in and trying to figure out what might be going on, can you let me know whether, when you say you moved the exact same code into a new file, whether the file is in the same project (the same directory) as the working stack?
d
I created a new directory in the same project, and pasted the code into a file called
__init__.py
lol styling fail 😄
g
😂 it's all good; I know what you mean
d
so I moved the code into
mycomponent/__init__.py
and then wrapped it in `class MyCustomFargateApp(pulumi.ComponentResource):``
g
And are you calling
pulumi up
(or preview) from the root, or from
mycomponent
?
d
and then in the original file
__main__.py
I referenced it as:
Copy code
app = mycomponent.MyCustomFargateApp(ServiceName, ImageUrl, HealthCheckPath, DesiredCount=DesiredCount, AppListenPort=AppListenPort)
I’m calling pulumi up from the project root
g
gotcha. One sec, let me check something
d
I fixed the issue by replacing with
pulumi_aws.lb.ListenerRule
g
oh, wait, really?
d
yeah it’s fully deployed and app is running 😄
g
iiiiinteresting
I'm happy you got it running!
d
yeah but aws.lb is ew 😄
g
But do you mind if I pass this info along to the folks responsible for the native provider and see if there's a bug?
d
yup
g
Because that doesn't make much sense on its face overall that it would fail, but I suspect it could be because the native provider is still in beta and there could be a bug on the other side
d
I don’t mind sharing code directly with folks, I’d rather not post it publicly tho
g
👍 thanks! I'll let you know what I find; might be a day or two
completely understand. I'm sharing it internally
d
want the entire project zipped?
g
not yet 🙂 Let me see if they've got a "ah-hah, but there wasn't X" kind of answer first
💯 1
b
can you do a
pulumi stack export
(which should give you a JSON representation of the entire project) and look through it for the offending resource? it should have a provider associated with it
that provider clearly has the wrong version
d
this happens before the resource has deployed tho
here, I commented out the
pulumi_aws.lb.ListenerRule
implementation and uncommented the
pulumi_aws_native.elasticloadbalancingv2.ListenerRule
implementation and this is what
pulumi up
looks like https://l.hr/GRqqe9
and the two implementations are as so: https://l.hr/NsDVv0
LOL literally if I remove the opts=child_opts it works fine
it just doesn’t get associated with the ComponentResource
b
Can you share the full code?
I can't debug it without looking at the code I'm afraid. Feel free to private gist it and dm me, I'll look tomorrow
d
will do, just documenting a few more cases first
if I do
opts=pulumi.ResourceOptions(parent=self, version="0.18.0")
it works exactly like I’d want it to 😄
oh my god
some earlier resource leaks the version over
if I just do
opts=child_opts
over and over again — it fails
if I do
opts=pulumi.ResourceOptions(parent=self)
, it works fine
so some earlier resource clobbers the version with the
aws
package version
all of them.
okay, I got it
the bug report is: if you create an object of
pulumi.ResourceOptions
, and then pass that into a mixture of
pulumi_aws
and
pulumi_aws_native
resources via
opts=my_opts
, the first one will
Copy code
if opts.version is None:
            opts.version = _utilities.get_version()
which will set “version” on the my_opts object and that will then get passed into the next resource which will reuse the version as if it was hardcoded
b
Are you setting an explicit provider when you call the component? Can you file an issue for this please
d
yup, was just building a repro case
(filing bug report)
g
Wow, catching up this morning, and that's an interesting bug. Thank you so much for digging in!
Looks like one of our engineers has already snagged the report to dig into. If there's any other way we can help, please let us know!
d
:)) thank you for showing interest yesterday, i probably wouldn’t have continued chasing it if it was just dead air
partypus 1
b
@damp-fall-55922 because of your awesome thorough bug report, we were able to get a fix written very quickly: https://github.com/pulumi/pulumi/pull/9802 Can you DM me or Laura your email? We'd like to send you a t-shirt as a thank you
💯 1
❤️ 1