https://pulumi.com logo
#google-cloud
Title
# google-cloud
a

aloof-traffic-97122

08/25/2022, 5:58 PM
hi friends, this is probably really simple, but I'm trying to create a gcp instance and a gcp instance group using the pulumi python API. The code for this looks like:
Copy code
instance = gcp.compute.Instance(...a bunch of args)
instance_group = gcp.compute.InstanceGroup(instances=[instance.self_link], ...other args)
When I run pulumi pre, I get
AttributeError: 'NoneType' object has no attribute 'self_link'
, so it looks like the instance is
None
. Are there any tips on how I debug what to do next?
for posterity, I figured out that this wasn't a pulumi issue -- someone was doing something tricky with monkey patching with our pulumi codebase that had unintended consequences
l

limited-rainbow-51650

08/26/2022, 8:17 AM
Just pass the
id
of the instance to the group:
Copy code
instance_group = gcp.compute.InstanceGroup(instances=[instance.id], ...other args)
See the example named
Example Usage - With instances and Named ports
in the docs: https://www.pulumi.com/registry/packages/gcp/api-docs/compute/instancegroup/