How to configure a typed object hierarchy in a project?TypeScript
Your requirement seems to be about creating a hierarchical project configuration using Pulumi. You can structure your stack configurations hierarchically where each level in the hierarchy is typed.
This provides a way to manage configurations for different environments (like staging, production) more effectively.
Here's an illustration using TypeScript:
Pulumi.<stack-name>.yamlfile, you can add your configuration:
passwordare then read from your stack configuration, and used in your Pulumi program. By defining the interface
DbConfig, you ensure that the configuration object adheres to the structure you expect. This is how you model hierarchical and typed configurations in Pulumi.
Remember to store sensitive data like
passwordas secrets in your Pulumi stack configuration to avoid exposing them in plain text.
Using these hierarchical and typed configurations, you can manage complex configurations cleanly and avoid potential runtime errors due to misconfigured properties.