Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

fix: add logic in runner to check to make sure that PULUMI is configured with a token #209

@qdzlug

Description

@qdzlug

Describe the bug
If you have not initialized Pulumi or set the PULUMI_AUTH_TOKEN environment variables you will get some pretty ugly
error messages when you run:

environment file [/home/ubuntu/kic-reference-architectures/config/pulumi/environment] passed validation
Stack configuration file [/home/ubuntu/kic-reference-architectures/config/pulumi/Pulumi.marajenks55.yaml] passed validation
All configuration is OK
Traceback (most recent call last):
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/automation/main.py", line 562, in <module>
    main()
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/automation/main.py", line 270, in main
    init_secrets(env_config=env_config,
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/automation/main.py", line 448, in init_secrets
    stack = auto.create_or_select_stack(stack_name=env_config.stack_name(),
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_local_workspace.py", line 552, in create_or_select_stack
    return _local_source_stack_helper(stack_name, work_dir, Stack.create_or_select, opts)  # type: ignore
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_local_workspace.py", line 594, in _local_source_stack_helper
    return init_fn(stack_name, ws)
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_stack.py", line 163, in create_or_select
    return Stack(stack_name, workspace, StackInitMode.CREATE_OR_SELECT)
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_stack.py", line 189, in __init__
    workspace.create_stack(name)
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_local_workspace.py", line 272, in create_stack
    self._run_pulumi_cmd_sync(args)
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_local_workspace.py", line 383, in _run_pulumi_cmd_sync
    return _run_pulumi_cmd(args, self.work_dir, envs, on_output)
  File "/home/ubuntu/kic-reference-architectures/pulumi/python/venv/lib/python3.9/site-packages/pulumi/automation/_cmd.py", line 78, in _run_pulumi_cmd
    raise create_command_error(result)
pulumi.automation.errors.CommandError: 
 code: 255
 stdout: 
 stderr: error: PULUMI_ACCESS_TOKEN must be set for login during non-interactive CLI sessions

To Reproduce
Steps to reproduce the behavior:

  1. Run w/o pulumi configured.
  2. Boom!

Expected behavior
Should check and prompt user to either login to pulumi or set the environment variable.

Your environment
n/a

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions