Is there a concept of "modules" in pulumi known fr...
# general
m
Is there a concept of "modules" in pulumi known from terraform or is that handled by usual programming language with functions and classes ?
g
The latter. With Pulumi, you'd use classes, functions, etc which can be packaged in
ComponentResources
that allow re-usability. Going further these re-usable packages can be disseminated using normal package repositories and managers. (npm, nuget, pypi, etc)
đź‘Ť 2
m
I see, and I would need to make sure I have those ComponentResources installed before hand rather than being able to define it within the code and source it from external git repo as it's the case with terraform?
f
no, they don’t need to be installed
a component resource is just a class
you either write it as part of a pulumi application or import it as a dependency (using a node module, python package, etc)
a component resource isn’t very different from just writing a function, either of them work as a unit of code reuse within pulumi
not that you don’t need to use a component resource
you can also call a function as many times as you want/need to
m
I see. Thanks for clarification. Would you also happen to know if I can somehow have the pulumi "login" defined in YAML on each of my projects? I want to use azure blob storage as (so called backend in terrafom) but I dont want to be "logged in" to it all the time. So for example if I go to my project directory and run pulumi commands it should know to use specific backend storage but if I go to another it should know to use s3 bucket for example
f
so the concept of logging in doesn’t map super cleanly to blob storage
it doesn’t create any additional credentials, pretty sure it just updates some config to point to that bucket as the default
For S3 I’m pretty sure it just follows the AWS credential chain, so if you’ve got a default set of credentials it will always try to use that
if you set some temporary credentials using environment variables it will use those
m
Right, so this is quite a deal breaker. Would you happen to know if automation API can handle the login part ? AKA 1. Single .py file 2. Login to azure and get access token ( custom not pulumi code to do that) 3. Configure the azure backend with sas token 4. Create or update stack 5. Run stuff