Pulumi Automation API: Difference between revisions
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
=Programming Model= | =Programming Model= | ||
<syntaxhighlight lang='py'> | <syntaxhighlight lang='py'> | ||
import pulumi | |||
def pulumi_program(): | def pulumi_program(): |
Revision as of 22:15, 3 March 2022
External
- https://www.pulumi.com/docs/guides/automation-api/
- https://github.com/pulumi/automation-api-examples/tree/main/python/inline_program
Internal
Overview
An inline Pulumi program example is available here: https://github.com/pulumi/automation-api-examples/tree/main/python/inline_program
Programming Model
import pulumi
def pulumi_program():
pass
org_name="my-org"
project_name ="my-project"
stack_name ="my-stack"
qualified_stack_name = f'{org_name}/{stack_name}'
pulumi_stack = pulumi.automation.create_or_select_stack(
stack_name=qualified_stack_name,
project_name=project_name,
program=pulumi_program) # a valid function must be passed here, 'None' does not work
print(f'successfully initialized stack {pulumi_stack}')
pulumi_stack.preview(on_output=print)
print(pulumi_stack.outputs())
pulumi.Output.all()