hi, I'm new to pulumi. Is it common to store iam p...
# python
s
hi, I'm new to pulumi. Is it common to store iam policy within the main.py or is it a better practice to load it from json/yaml file?
a
Thanks for asking, I’ve been wondering that too.
b
Either approach is valid, and comes down to preference. Often I see longer, more complex, or pre-defined policies defined in .json or .yaml files and loaded, while short or programmatically generated IAM policies are defined in-line with code (using multi-line strings)
additionally, in python, it can be quite convenient to define a policy as an object (dict), and render it into json with
json.dumps(policy_obj)
a
No, no preference, 😆 . That’s too difficult to have code uniformity 😆 😉
I hate the fact that for myself, I keep flip flopping thinking doing one way and then I feel like another way is better.
b
I typically do it inline myself, if that helps... feels weird to load code into a program from a file, when i can just have it part of the program (since json is just code)
a
Yes, it’s just that sometimes it makes “the code” longer… Yep just preference and convenience …