This program is an example for implementing Snowflake resources in an additive deployment manner.
It orchestrates which infrastructure components are created during a pulumi up run by evaluating configuration-driven feature flags.
The program intentionally contains no Snowflake resource definitions.
All infrastructure is provisioned through reusable ComponentResources.
__main__.py acts as the composition and control layer for the deployment.
It is responsible for:
- Reading Pulumi configuration
- Enabling or disabling components
- Wiring component outputs to downstream components
- Exporting stack outputs
- Evaluate config flags to determine which components run
- Instantiate
DatabaseComponentand/orSchemaComponent - Support additive deployments across multiple runs
- Keep infrastructure logic isolated inside components
Each component is gated behind a Pulumi configuration boolean with the same name as the component.
| Config Key | Behavior |
|---|---|
db_component = true |
Creates a Snowflake database |
schema_component = true |
Creates a schema in a database |
Components can be enabled independently in different pulumi up runs.
| Key | Type | Required | Description |
|---|---|---|---|
db_component |
bool |
No | Enable database creation |
schema_component |
bool |
No | Enable schema creation |
database_name |
string |
Conditional | Target database name |
schema_name |
string |
Conditional | Target schema name |
- Read Pulumi configuration
- Evaluate
db_componentflag - Create database if enabled
- Evaluate
schema_componentflag - Create schema if enabled
- Export relevant outputs
cfg = Config()
if enabled("db_component"):
DatabaseComponent(...)
if enabled("schema_component"):
SchemaComponent(...)pulumi config set DatabaseComponent true
pulumi config set SchemaComponent false
pulumi config set databaseName DEMO_DB
pulumi up
pulumi config set DatabaseComponent false
pulumi config set SchemaComponent true
pulumi config set schemaName ANALYTICS
pulumi up