- why you might want to execute Pulumi commands
- how to execute Pulumi commands via Webiny CLI
To deploy necessary cloud infrastructure, by default, Webiny relies on Pulumi, a modern infrastructure as code framework. Find out more in the following IaC with Pulumi key topic.
And while in most cases these commands are enough to get the job done, still, there is a chance that you might need to use other specific Pulumi commands, via the Pulumi CLI.
For example, in case of the pending operations issue, you will most certainly want to execute the
pulumi stack export and
pulumi stack import commands, in order to repair your cloud infrastructure state files.
Unless you’ve installed the Pulumi CLI manually, trying to execute these in your terminal will result with an error, saying that the
pulumi command was not found. Basically, this happens because Webiny doesn’t install the Pulumi CLI globally on your system. It’s set up locally and separately for every Webiny project, by downloading necessary binaries into a temporary folder, located in your Webiny project.
Because of this, Webiny CLI provides the
pulumi command, which enables you to run any Pulumi command you might need. And not only that. Using Pulumi CLI through Webiny CLI will free you from setting some of the necessary environment variables and configuration params, because Webiny CLI handles these internally. For example, by specifying the environment via the
--env argument, the Webiny CLI will automatically select the right Pulumi stack for you. No need for extra commands that would otherwise be needed, if we were using the standalone Pulumi CLI.
pulumi command is as simple as follows:
As we can see, upon executing the
pulumi command, we must provide three things:
- the project application folder (for example
- the environment, via the
- the actual Pulumi command
Note that the
--, used in shown examples, is not an error. The actual Pulumi command you want to execute must come after it, otherwise you will end up with unexpected results.
Pulumi CLI is downloaded into the following folder in your Webiny project:
Although both can be used to get the job done, we recommend you always rely on the Webiny CLI. This is because of the reasons mentioned in this guide:
- no need to install the Pulumi CLI manually
- no need to set extra environment variables and configuration params
- anything that can be achieved with the Pulumi CLI can also be achieved with Webiny CLI
This error may sometimes pop up because Webiny’s Pulumi SDK package runs all Pulumi commands in a non-interactive mode. Because of this, sometimes you will need to pass the
--yes flag in order to confirm the execution of the Pulumi command you’re about to execute.