This guide will help you get up and running with Pulumi Any Terraform providers in minutes.
Prerequisites#
Before you begin, make sure you have:
- Node.js 18.0 or later (for TypeScript/JavaScript)
- Pulumi CLI 3.190.0 or later
- Package Manager: npm, yarn, or pnpm
- A Pulumi account (sign up at app.pulumi.com)
Installing Pulumi#
If you don't have Pulumi installed:
Verify your installation:
Installation#
Each provider can be installed independently as an npm package.
Using npm#
Using yarn#
Using pnpm#
Creating Your First Project#
1. Initialize a Pulumi Project#
Create a new directory and initialize a Pulumi project:
Follow the prompts to set up your project. This creates:
Pulumi.yaml- Project configurationindex.ts- Your infrastructure codepackage.json- Node.js dependencies
2. Install a Provider#
Add a provider to your project:
3. Configure Provider Credentials#
Most providers require API credentials. Configure them using Pulumi config:
Alternatively, use environment variables:
4. Write Your Infrastructure Code#
Edit index.ts to define your infrastructure:
5. Deploy Your Infrastructure#
Preview and deploy your infrastructure:
Pulumi will show you what resources will be created. Type "yes" to proceed.
6. Update and Manage#
To update your infrastructure, modify your code and run pulumi up again:
7. Clean Up#
When you're done, destroy your resources:
Example: Multi-Resource Deployment#
Here's a more complete example using Better Uptime to set up monitoring:
Using Multiple Providers#
You can use multiple providers in the same project:
Configuration Best Practices#
1. Use Pulumi Config for Secrets#
Always use --secret flag for sensitive data:
2. Organize with Stacks#
Use different stacks for different environments:
3. Use Stack References#
Share outputs between stacks:
Next Steps#
Now that you've created your first infrastructure:
Common Commands#
Here's a quick reference of Pulumi commands:
| Command | Description |
|---|---|
pulumi new | Create a new project |
pulumi preview | Preview changes before deploying |
pulumi up | Deploy infrastructure |
pulumi destroy | Destroy all resources |
pulumi stack | Manage stacks |
pulumi config | Manage configuration |
pulumi state | Manage state |
pulumi refresh | Refresh state to match actual resources |
pulumi cancel | Cancel an in-progress update |
Getting Help#
If you run into issues:
- Check the Troubleshooting Guide
- Review Pulumi Documentation
- Search GitHub Issues
- Open a new issue with details about your problem