https://pulumi.com logo
#azure
Title
# azure
w

wet-noon-14291

06/16/2020, 7:59 PM
Let's say I create a servicebus namespace, queue, topics and subscriptions through pulumi. What is the best way to access the service bus from an application you write. Ideally I wouldn't like to hard code the name in this place since the name might be changed when deploying to a new stack. Do I in the application read the actual names from the pulumi output? Or is this one of the scenarios where you override the name of the resource to not include the suffix?
r

rhythmic-finland-36256

06/16/2020, 9:35 PM
How do you deploy your application which needs to connect to the servicebus? In our case with container based deployments (azure container instances or Kubernetes deployments) we inject those environment specific values using environment variables or indirectly using Kubernetes secrets that get mapped to env vars in the container. Therefore the application is built in a way that it allows overwriting configurations via env vars. See https://12factor.net/config
So if you deploy the app using pulumi, you can access those values directly from inside the pulumi program and provision those fields. If you have a different way of deploying, you also have the possibility to access the pulumi stack output (all exported variables of the program) independently from performing the pulumi run and e.g. generate a configuration file with the names you obtained from the output.
w

wet-noon-14291

06/17/2020, 2:31 PM
That is actually pretty cool, should have thought about that ๐Ÿ™‚. I did it the naive way with just setting the
Name
in the args properties so I know what it will be called. I like your approach better.
๐Ÿ‘Œ 1
we will also have our stuff running on k8s, so it fits really well.
r

rhythmic-finland-36256

06/17/2020, 5:33 PM
Donโ€™t hesitate to ask if you want to learn about what worked well for us and what not. Happy to share some experiences.
w

wet-noon-14291

06/20/2020, 9:18 PM
@rhythmic-finland-36256 I accidently answered in the wrong channel. Awesome tips and got something working fairly simple.
๐Ÿ‘Œ 1
3 Views