This message was deleted.
# getting-started
s
This message was deleted.
p
I haven’t used pulumi with golang but I guess I can still be helpful 😉
do you want to use that from another pulumi stack?
If it’s within the same stack, you don’t have to even export it. You should be able to simple reference the variable internally in golang code.
(see https://github.com/pulumi/examples/blob/master/aws-go-s3-folder/main.go where BucketPolicy references previously created Bucket, saved in
siteBucket
variable)
If you want to reference that in a separate Pulumi stack, you want to use StackReference.
in that case, the stack you want to import something from MUST declare the variable as the output (using
ctx.Export
)
f
So I need to write pulumi code in Imperative style, also one more question, is pulumi.Run only called once in a given stack?
Thanks for the quick response...
p
I don’t think you should write it in imperative style… the whole pulumi concept is being declarative. I hope you didn’t misunderstand me somehow.
Regarding your last question, cannot say for sure (no pulumi golang experience) but I guess you shouldn’t have more than one
pulumi.Run
invocation.
Each program (regardless of the programming language used) basically declares the resources and then pulumi engine (not sure if that’s the name used by Pulumi team) based on that performs a reconciliation loop by trying to match the actual state with the one written (declared) by you.
Not sure how much experience you have with similar tools (like terraform) so if you have any more questions, feel free to ask them 🙂