The Local provider allows you to manage local filesystem resources in your infrastructure, useful for generating configuration files, storing deployment artifacts, and managing sensitive credentials.
Provider Configuration#
The Local provider doesn't require authentication or API credentials. It's a utility provider that operates on the local filesystem.
Basic Setup#
Provider Instance (Optional)#
While not required, you can explicitly create a provider instance:
Configuration Reference#
The Local provider has no required configuration options. All functionality is available without setup.
Resource Options#
Individual resources support the following common options:
- filename: Path to the file to create or read (required)
- content: Content to write to the file
- contentBase64: Base64-encoded content to write
- filePermission: File permissions (e.g.,
"0644") - directoryPermission: Directory permissions for parent directories (e.g.,
"0755")
Use Cases#
The Local provider is commonly used for:
- Configuration Generation: Generate config files from Pulumi outputs
- Deployment Artifacts: Write deployment metadata and artifacts
- Credential Management: Store credentials from other providers locally
- Template Rendering: Generate files from templates with dynamic values
- Command Execution: Run local commands to gather information
File Permissions#
Standard Files#
Sensitive Files#
Sensitive files automatically use restrictive permissions:
Integration Examples#
With Cloud Providers#
With CI/CD Pipelines#
Best Practices#
Use Absolute Paths#
Protect Sensitive Data#
Clean Up Generated Files#
Generated files are managed by Pulumi state. When a resource is destroyed, the corresponding file is removed.
Troubleshooting#
Common Issues#
Issue: Permission denied
Solution: Ensure the Pulumi process has write permissions to the target directory.
Issue: Directory not found
Solution: The parent directory must exist. Use directoryPermission to create parent directories automatically.
Issue: File not updating
Solution: Verify the content input has actually changed. Pulumi only updates resources when inputs differ.
Next Steps#
- File Resource - Create and manage local files
- Sensitive File Resource - Handle sensitive file content