Outcome: After this guide, you can manage Formal resources using Pulumi infrastructure-as-code.
Prerequisites: Pulumi CLI, Formal API key, programming language environment (TypeScript, Python, Go, or C#).
Overview
The Formal Pulumi Provider enables you to manage Connectors, Resources, Policies, Users, and all other Formal objects as infrastructure-as-code using your preferred programming language.Installation
The Formal provider is available for multiple programming languages:- TypeScript/JavaScript
- Python
- Go
- C#
Authentication
Create an API key in the Formal console:- Navigate to API Keys
- Click Create API Key
- Name the key (e.g., “pulumi-production”)
- Copy the key immediately
Examples
Full Production Stack
- TypeScript
- Python
- Go
- C#
Resource Documentation
Full documentation for all resources: Core Objects: Integrations:Example Repositories
Formal provides complete Pulumi examples: Clone and customize for your needs:Best Practices
Use Version Constraints
Use Version Constraints
Pin provider versions to avoid unexpected changes:TypeScript:Python:
Store State Remotely
Store State Remotely
Use Pulumi Cloud or self-hosted backends for team collaboration:
Use Configuration
Use Configuration
Parameterize configurations for reusability:Access in code:
Separate Environments
Separate Environments
Use separate stacks for prod/staging/dev:
Enable Termination Protection
Enable Termination Protection
Protect production resources:
Importing Existing Resources
Bring existing Formal objects under Pulumi management:Outputs
Export useful information:- TypeScript
- Python
- Go
- C#
Troubleshooting
Authentication failed
Authentication failed
Possible causes:
- Invalid API key
- API key not set correctly
- Verify API key in Formal console
- Check configuration:
pulumi config get formal:apiKey - Ensure no whitespace in key
Provider not found
Provider not found
Possible causes:
- Package not installed
- Wrong package name
- Install correct package for your language
- Verify import statements
- Check package.json/requirements.txt
Resource creation fails
Resource creation fails
Possible causes:
- Invalid resource configuration
- Missing required fields
- Check API documentation
- Verify all required fields are set
- Check resource naming conventions