@Thomas Farvour I don’t know if I did understand c...
# python
w
@Thomas Farvour I don’t know if I did understand correctly, but you can override the Pulumi config file, with the Stack config file if you do not want to use the
config
flag. You can’t not use the Pulumi.yaml since this is the global configuration of your project, but you can override it whether with the Stack config file or the config flag.
g
I was trying to figure out how to use a different path to the file, so I could generate dynamic projects via automation framework. I think I figured it out:
Copy code
stack_name = f"{args.cluster_name}.{args.namespace}"
    project_dir = os.path.join(PULUMI_PROJECTS_DIR, f"k8s-{project}")
    temp_dir = tempfile.TemporaryDirectory(prefix=f"pulumi-rendered-k8s-project-{project}")
    stack = auto.create_or_select_stack(
        stack_name,
        work_dir=temp_dir.name,
        opts=auto.LocalWorkspaceOptions(
            work_dir=temp_dir.name,
            secrets_provider=None,
            project_settings=auto.ProjectSettings(
                name=f"k8s-{project}",
                main=project_dir,
                backend=auto.ProjectBackend(url=f"file://{temp_dir.name}"),
                runtime="python",
            ),
        ),
    )
    <http://logger.info|logger.info>("Created/selected stack", stack_name=stack_name, project=project)
keeps the state & stacks in a temporary directory, and uses the "real" program location via project_dir as main.
w
Nice!!!!