Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qdzlug opened this issue Nov 18, 2022 · 0 comments

Comments

@qdzlug
Copy link
Contributor

qdzlug commented Nov 18, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant