lemon-church-28946
07/15/2022, 7:42 PMaws.cloudfront.Distribution
.
◦ Seems the only way to bounce between regions is to set the aws:region
configuration.
▪︎ Please correct me if I'm wrong about setting that value.
• Questions:
◦ Should the aws:region
config be changed between calls to aws.cloudfront.Distribution
, can I expect the subsequent distribution to be deployed in the most resent setting?
◦ If using the stack config to exchange parameters between the local program and the Pulumi program, what is the most effective method of getting a pulumi.automation.Stack
instance in the Pulumi program?
▪︎ I've considered __file__
, pulumi.get_stack()
, and pulumi.automation.select_stack()
but it seems like I'm missing a more obvious method.
▪︎ Edits:
• I'm looking to set new values to the stack's config.
• Can confirm that the pulumi.automation.select_stack()
works.bored-oyster-3147
07/15/2022, 10:25 PMlemon-church-28946
07/15/2022, 10:34 PMbored-oyster-3147
07/15/2022, 10:36 PMlemon-church-28946
07/15/2022, 10:45 PMpulumi.automation.Stack
instance within the Pulumi program itself. That seems to interact with the stack's YAML file when running Stack.set_config
and Stack.get_config
.
import pulumi
from pulumi import automation as auto
from pathlib import Path
# bad ideas
stack = auto.select_stack(
stack_name=pulumi.get_stack(),
work_dir=str(Path(__file__).parent.absolute()))
# set a config value
stack.set_config('stuff', auto.ConfigValue('things'))
# log the newly set value
<http://pulumi.info|pulumi.info>(stack.get_config('stuff'))
It's probably working because I'm more-or-less using it as a method of sending output back to the automation program (less the aws:region
config).
Definitely heeding your advice though.bored-oyster-3147
07/15/2022, 10:48 PMlemon-church-28946
07/15/2022, 11:03 PM