LinuxCommandLibrary

pulumi-state

Manage Pulumi state backend

TLDR

Delete a resource from the current stack's state

$ pulumi state delete
copy

Move a resource from the current stack to another
$ pulumi state move [resource_urn] --dest [stack_name]
copy

Rename a resource in the current stack's state
$ pulumi state rename
copy

Repair an invalid state
$ pulumi state repair
copy

Edit a stack's state in the editor specified by the EDITOR environment variable
$ pulumi state edit --stack [stack_name]
copy

Display help
$ pulumi state [[-h|--help]]
copy

SYNOPSIS

pulumi-state [command] [flags]

PARAMETERS

--help
    Show help for the command.

DESCRIPTION

The `pulumi-state` command is a low-level utility designed for inspecting and manipulating the Pulumi state backend directly. This tool offers functionalities beyond the regular Pulumi CLI, enabling advanced debugging, migration, and recovery operations. It is primarily used for tasks such as inspecting the state file content, migrating state between backends (e.g., from local to cloud storage), and performing manual repairs or audits of the state data.

Warning: Direct manipulation of the state can lead to corruption and data loss. Use this tool with extreme caution and only when instructed by Pulumi support or when you are confident in the changes you are making. Improper use can render your Pulumi stacks unusable. It is typically used to recover from some error conditions, manually modify the state file, or investigate some conditions. It is not designed for general management of state and stack creation.

CAVEATS

Direct manipulation of the Pulumi state is inherently risky. Always back up your state file before making any changes. Incorrect modifications can lead to irreversible data loss or stack corruption. Use this tool only when necessary and with a clear understanding of the potential consequences.

STATE FILE LOCATION

The location of the state file depends on the backend configured for your Pulumi stack. It could be a local file (e.g., `Pulumi.your-stack-name.yaml`) or a location in cloud storage (e.g., an AWS S3 bucket or an Azure Blob Storage container). This command interacts directly with that location.

COMMON COMMANDS

It is important to consult the official Pulumi documentation before using this command, as its functionalities may change with updates. Some common subcommands could include viewing, exporting, and potentially modifying sections of the state. Ensure you have the right access permissions configured for the state backend before attempting any operation.

HISTORY

The `pulumi-state` command was introduced to provide more granular control over the Pulumi state backend, particularly for advanced use cases like state migration, debugging, and recovery. It's a lower-level tool intended for experienced users and administrators who require direct access to the state data. It evolves alongside the Pulumi CLI but with a focus on internal operations and debugging. It should be used with caution and only when recommended, and it's less documented than standard pulumi features.

SEE ALSO

Copied to clipboard