Hi All i am facing this issue Exception: Failed to...
# general
b
Hi All i am facing this issue Exception: Failed to export output. Root resource is not an instance of 'Stack' on calling pulumi.export
f
Can you send the code snippet?
b
yes sure
import pulumi from pulumi_openstack import compute # # Create an OpenStack resource (Compute Instance) instance = compute.Instance('runtest123', flavor_name='m1.large',image_name='FortiOS') # # Export the IP of the instance pulumi.export('runtest123', instance.name) _# pulumi.export('runtest123', instance.access_ip_v4)_
name: "development" runtime: name: "python" options: virtualenv: "venv" description: "war_zone" config: openstackuserName "######" openstackpassword "########" openstackauthUrl "###############" openstacktenantName "development" openstackregion "RegionOne"
this is my YAML file
f
Please edit it and insert "code block"
b
i did'nt get it
what i have to edit
can we connect on a call
f
Screenshot 2023-08-07 at 14.47.30.png
Copy code
this is the code
the right next to the circle
b
import pulumi
from pulumi_openstack import compute
# # Create an OpenStack resource (Compute Instance)
instance = compute.Instance('runtest123', flavor_name='m1.large',image_name='FortiOS')
# # Export the IP of the instance
pulumi.export('runtest123', instance.name)
_`# pulumi.export('runtest123', instance.access_ip_v4)`_
import pulumi from pulumi_openstack import compute # # Create an OpenStack resource (Compute Instance) instance = compute.Instance('runtest123', flavor_name='m1.large',image_name='FortiOS') # # Export the IP of the instance pulumi.export('runtest123', instance.name)
Copy code
# pulumi.export('runtest123', instance.access_ip_v4)
f
which cloud?
b
openstack
did you create a stack?
b
no i didnt
i am using the same code you shared above
f
you can try to create a stack
b
how can i do it
can you share any link for same.
f
pulumi stack ls
pulumi stack init dev
b
image.png
f
ok so you have a stack already
b
yes i have
f
what a command you send via the cli?
try to comment out the export and try with
Copy code
pulumi up -s dev --diff
b
pulumi up
i don't want to run it via CLI i want to run it through my code
f
go for it, just dont forget to comment out the export command and show us the diff
b
sure just a sec
f
Are you sure there is the name as "output"?
b
yes
i also changed the name from runtest123 to runtest456
but still after executing my main.py file i am not able to create any instance their
f
yes but you know the name already so it's meaningless to return the name
b
but same if i run using pulumi up then it works
f
its telling you that there is no "name" as output
only ipv4
b
ok i don't want to return the name but when i run my script it should create the instance in my openstack
that is also it's not doing
f
you should try to destroy the env
and then to try to build it again
b
ok i changes it to ipv4
but still its not running
f
b
image.png
yes i did
what's next
should i execute the main.py file
f
Copy code
pulumi up -s dev --diff
b
ok
f
cool, try to approve it and take a look
b
should i hit yes
f
yes
b
should i change the image name and then try it again
Hi you there
f
ya
ok
b
should i press yes
f
ya
b
also if i use only pulumi up it works and creates a instance
but i don't want to do it using pulumi up command
i want it to be executed with my code
f
i'm sorry i don't have any idea
b
no issues thanks for the help and quick response