Hi <#CDE799L1M|> team, It is good to become part ...
# python
f
Hi #CDE799L1M team, It is good to become part of this community. Here is my quick question. I have python-gcp pulumi project. I have a requirement of defining a variable in the stack config yaml file and substitute them as substring in many places in the same file. For example: test.yaml: region: &region "us-west2" compute: name: "testvm-*region" But this is not working as expected. Any suggestions ?
a
I'm pretty sure you can't do string concatenations with yaml variables
f
@adventurous-butcher-54166 yes thats my suspect too.don't we have any option to do this in Pulumi too ?
a
You can do this in your Python code. Since I don't like naming things my approach is to use a auto naming function in my IaC projects. Every Pulumi stack is required to define the following configuration values: •
env
(dev/prod/stage etc.) •
workload_name
region
I keep track of the service prefixes and region shorthands centrally so basically all I have to pass in to name parameters is something like.. •
stack.name_for(SomePulumiResource)
• Returns a name in the format:
<service prefix>-<workload_name>-<env>-<region shorthand>
• i.e.
vm-postgres-prod-usw