Pulumi Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 107: Line 107:
</syntaxhighlight>
</syntaxhighlight>
The command must be invoked inside an empty directory. <font color=darkkhaki>Will it create a sub-directory, or will use the current directory as root?</font>
The command must be invoked inside an empty directory. <font color=darkkhaki>Will it create a sub-directory, or will use the current directory as root?</font>
If Python is used, <code>pulumi new</code> creates a new [[Python_Pulumi#Python_Pulumi_and_Virtual_Environments|virtual environment]].
If Python is used, <code>pulumi new</code> creates a new [[Python_Pulumi#Python_Pulumi_and_Virtual_Environments|virtual environment]].



Revision as of 04:59, 11 January 2022

External

Internal

Overview

Global Options

-s|--stack

--non-interactive

Logout

pulumi logout

Login

https://www.pulumi.com/docs/reference/cli/pulumi_login/
pulumi login [--cloud-url https://something.example.com]

Without argument, logs into the Pulumi-managed backend. Credentials are cached locally and can be viewed with ~/.pulumi/credentials.json.

State can be maintained in different places, as follows:

  • For a "https://" URL, the command line process will access the remote backend via REST.
  • For a "file://" URL, the state is managed locally.
  • For a "s3://" URL, state is maintained in an S3 bucket.
  • For a "gs://" URL, state is maintained in an GCP bucket.
  • For a "azblob://" URL, state is maintained in an Azure blob.

Login Options

-c|--cloud-url

A cloud URL to log in to. Then, what does pulumi login https:/... mean and how is different from the same command with an extra --cloud-url?

--local

--local is a shortcut for:

pulumi login file://~

Info

Dumps identity, backend name and URL, Open Directory groups, etc.

pulumi whoami --verbose

This reads ~/.pulumi/credentials.json.

Organization Info

pulumi org ls
pulumi org get <org-name>

Stack Operations

Pulumi Stacks

List Stacks

Display the list associated with the current project.

pulumi stack ls

Show Output Properties

Show a stack's output properties:

pulumi stack output [--show-secrets]

Select a Stack

pulumi stack select

Display Stack Resources

pulumi stack

Display Stack Tags

https://www.pulumi.com/docs/reference/cli/pulumi_stack_tag_ls/
pulumi stack tag ls

Create Stack

pulumi stack select --create --secrets-provider=passphrase <org-name>/<stack-name>

Switch the Workspace to a Given Stack

Selecting a stack allows you to use commands like config, preview, and update without needing to type the stack name each time. If no stack argument is supplied, you will be prompted to select one interactively.

pulumi stack select --create --secrets-provider=passphrase <org-name>/<stack-name>

Options:

  • --create: If selected stack does not exist, create it.
  • --secrets-provider: Use with --create flag, The type of the provider that should be used to encrypt and decrypt secrets. Possible choices: default, passphrase, awskms, azurekeyvault, gcpkms, hashivault, default "passphrase".

Remove (Delete) a Stack

Removes (deletes) a stack. For the difference between deleting and destroying a stack, see:

Destroying vs. Deleting a Stack
pulumi stack rm some_stack

Project Operations

New Project

https://www.pulumi.com/docs/reference/cli/pulumi_new/

Create a new project and stack from template. If no template is provided, a list of suggested templates will be presented, so they can be selected interactively.

pulumi new

Full syntax:

pulumi new [template|url] [flags]

The command must be invoked inside an empty directory. Will it create a sub-directory, or will use the current directory as root?

If Python is used, pulumi new creates a new virtual environment.

Plugin Operations

List

pulumi plugin ls

Configuration Operations

List Configuration Values

pulumi config [-s <stack-name>]

Display the configuration value for the current stack. If -s <stack-name> is specified, use that stack instead.

Set a Configuration Value

pulumi config -s some-stack --non-interactive set some_key some_value
pulumi config set --path ... some_value

Dry Run

pulumi preview -s some-stack --non-interactive

Apply Infrastructure

pulumi up

Example:

pulumi up -y -s some_stack --non-interactive

Run, expecting no changes. What does that mean?

pulumi up -y -s some_stack --non-interactive --expect-no-changes