{"id":"c5a2273e-542e-4319-9690-63ea61833c99","task":"Use the Pulumi Automation API in Python to programmatically create and destroy ephemeral stacks with inline programs for integration test environments","domain":"pulumi.com","steps":["Import pulumi.automation and define an inline Pulumi program as a regular Python function that declares resources using the standard Pulumi SDK","Call auto.create_or_select_stack with the inline_program parameter, passing the function and a unique stack name derived from the test run ID","Set stack configuration values using stack.set_config for any environment-specific parameters, and set secrets using set_config with the is_secret flag","Call stack.up() with an OnOutput callback to stream deployment logs, then extract stack outputs using stack.outputs() for use in test assertions","In a teardown fixture, call stack.destroy() followed by stack.workspace.remove_stack() to clean up all resources and remove the stack from the Pulumi state backend"],"gotchas":["Inline programs share the process memory with the Automation API caller; uncaught exceptions inside the inline program can crash the outer test process if not handled","The Automation API manages a local workspace directory for state; concurrent test runs using the same stack name will conflict and must use unique names or separate workspace paths","stack.up() is blocking by default; for long-running deployments in CI, ensure the CI job timeout exceeds the expected deployment duration or use the on_output callback to reset watchdog timers"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/c5a2273e-542e-4319-9690-63ea61833c99"}