https://pulumi.com logo
#python
Title
# python
c

curved-morning-41391

10/23/2023, 10:32 PM
Has anyone created a custom CLI in Python using the Automation API?
s

square-market-74936

11/17/2023, 2:31 PM
This is a simplified version of what works for me
Copy code
from pulumi.automation import ProjectSettings, LocalWorkspace, Stack

settings = ProjectSettings(
    name="my_project",
    backend={"url": "<s3://my-bucket>"},
    runtime={"name": "python"},
    description="description: A minimal AWS Python Pulumi program extra",
)

ws = LocalWorkspace(
    work_dir="/app/pulumi",
    project_settings=settings,
)

ws.install_plugin("gcp", "7.1.1")

stack = Stack.create(stack_name="my_stack", workspace=ws)

stack.set_config("gcp:region", "some-region")

stack.up(log_verbosity=4, diff=True, log_flow=True)