Pulumi.yaml
Overview
`Pulumi.yaml` is a configuration file used by the Pulumi infrastructure as code (IaC) tool to define and describe a specific Pulumi project. This file provides metadata about the project such as its name, runtime environment, and description. Pulumi uses this file as the entry point to orchestrate infrastructure deployments written in various supported programming languages.
In this particular case, `Pulumi.yaml` defines a project named **thorchain-v1**, which uses the **Node.js** runtime, and is described as the "thorchain-v1 coin stack." This minimal configuration file enables Pulumi to recognize the project and run the appropriate code to provision and manage cloud infrastructure resources.
Detailed Explanation
File Structure and Fields
Field | Description | Example |
|---|---|---|
`name` | The unique name of the Pulumi project. This is used to identify the project internally. | |
`runtime` | Specifies the programming language environment used for the Pulumi program. | `nodejs` |
`description` | A short human-readable description of the project’s purpose or function. |
Usage
The `Pulumi.yaml` file is typically located in the root directory of a Pulumi project. Pulumi CLI commands such as `pulumi up`, `pulumi preview`, or `pulumi destroy` rely on this file to identify project settings before executing.
Example workflow for using this file:
# Preview infrastructure changes for the project
pulumi preview
# Deploy infrastructure as defined in the project's Node.js program
pulumi up
# Destroy all resources managed by the project
pulumi destroy
Important Implementation Details
Runtime Field: Specifying
nodejsindicates that Pulumi should use the Node.js runtime environment to execute the infrastructure code. This means the actual infrastructure definitions are expected to be written in JavaScript or TypeScript.Project Metadata: The fields in this YAML file are essential for Pulumi's internal state management and project identification, but do not themselves define any infrastructure resources. The resources are defined in separate source files (e.g.,
index.js,index.ts).Extensibility: Additional configurations such as stack configurations (
Pulumi.<stack>.yaml), secrets management, and plugin versions are managed outside this file, allowingPulumi.yamlto remain a lightweight project descriptor.
Interaction with Other Parts of the System
The
Pulumi.yamlfile acts as the bridge connecting Pulumi CLI commands to the user-defined infrastructure code written in Node.js.It interacts with:
Source Code Files: JavaScript or TypeScript files where the actual infrastructure resources (e.g., cloud services, virtual machines) are declared.
Pulumi Stacks: Separate configuration files (
Pulumi.<stack>.yaml) that provide environment-specific parameters.Pulumi CLI: Uses this file to identify the project context during deployment and management operations.
Pulumi Service or Backend: Where state and deployment history are stored, identified per project name.
Visual Diagram
The following flowchart illustrates the role of `Pulumi.yaml` within the Pulumi project workflow:
flowchart TD
A[Pulumi CLI Command] --> B[Reads Pulumi.yaml]
B --> C[Identifies Project Name & Runtime]
C --> D[Loads Node.js Infrastructure Code]
D --> E[Executes Infrastructure Deployment]
E --> F[Manages Cloud Resources]
E --> G[Updates Pulumi State Backend]
F --> H[Cloud Provider APIs]
Explanation:
When a Pulumi CLI command is executed (e.g.,
pulumi up), Pulumi first reads thePulumi.yamlfile.It uses the
nameandruntimefields to identify the project and the language runtime.Then it loads and runs the Node.js program that defines the infrastructure.
Pulumi translates this into cloud provider API calls to create or update resources.
The state backend is updated to track resource status and project state.
Summary
Pulumi.yamlis the project descriptor for Pulumi infrastructure-as-code projects.It defines the project name, runtime environment, and a brief description.
This file allows the Pulumi CLI to identify and execute the infrastructure code written in Node.js.
It does not contain resource definitions but is critical for project initialization.
Works in conjunction with source code files and Pulumi stacks for a full IaC deployment lifecycle.
This minimal but essential configuration file ensures Pulumi can manage infrastructure deployments consistently across environments, matching the project’s intended runtime and identity.