nginxinc / kic-reference-architectures

MARA: Modern Application Reference Architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: check for Pulumi access token versus bombing out when not found

qdzlug opened this issue · comments

Describe the bug
Currently, if we do not have a Pulumi access token set the program merrily chugs along until it hits...

HA mode enabled: True
Traceback (most recent call last):
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/automation/main.py", line 490, in <module>
    main()
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/automation/main.py", line 213, in main
    init_secrets(env_config=env_config, pulumi_projects=provider.execution_order())
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/automation/main.py", line 381, in init_secrets
    stack = auto.create_or_select_stack(stack_name=env_config.stack_name(),
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/site-packages/pulumi/automation/_local_workspace.py", line 513, in create_or_select_stack
    return _local_source_stack_helper(stack_name, work_dir, Stack.create_or_select, opts)  # type: ignore
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/site-packages/pulumi/automation/_local_workspace.py", line 555, in _local_source_stack_helper
    return init_fn(stack_name, ws)
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 163, in create_or_select
    return Stack(stack_name, workspace, StackInitMode.CREATE_OR_SELECT)
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 189, in __init__
    workspace.create_stack(name)
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/site-packages/pulumi/automation/_local_workspace.py", line 272, in create_stack
    self._run_pulumi_cmd_sync(args)
  File "/home/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/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/jschmidt/repos/kic-reference-architectures/pulumi/python/venv/lib/python3.8/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

We should verify this / trap the error and allow the user to remediate the issue.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy w/o having a Pulumi access token
  2. See error

Expected behavior
Should prompt user for the token if it's not found.

Your environment

Additional context
None.