1. Docs
  2. Concepts
  3. Projects

Projects

A Pulumi project is any folder which contains a Pulumi.yaml file. When in a subfolder, the closest enclosing folder with a Pulumi.yaml file determines the current project. A new project can be created with pulumi new. A project specifies which runtime to use and determines where to look for the program that should be executed during deployments. Supported runtimes are nodejs, python, dotnet, go, java, and yaml.

Project file

The Pulumi.yaml project file specifies metadata about your project. The project file must begin with a capitalized P, although either .yml or .yaml extension will work.

A typical Pulumi.yaml file looks like the following:

name: webserver
runtime: nodejs
description: Basic example of an AWS web server accessible over HTTP.

In addition, when using JavaScript, the working directory for the project should contain a package.json that points to a file such as index.js. In Python, there should either be a __main__.py file or a setup.py file that defines the entry point.

The following are other examples of Pulumi.yaml files that define project configurations for other use cases:

  • A Pulumi.yaml file for a nodejs program that uses JavaScript rather than TypeScript.

    name: my-project
    description: A minimal JavaScript Pulumi program.
    runtime:
        name: nodejs
        options:
            typescript: false
    
  • A Pulumi.yaml file for a go program that will only use a pre-built executable by the name mybinary.

    name: my-project
    runtime:
        name: go
        options:
            binary: mybinary
    description: A minimal Go Pulumi program
    
  • A Pulumi.yaml file for a dotnet program that will use a pre-built assembly MyInfra.dll under the bin directory.

    name: my-project
    runtime:
        name: dotnet
        options:
            binary: bin/MyInfra.dll
    description: A precompiled .NET Pulumi program
    
  • A Pulumi.yaml file for a java program that will use a pre-built JAR target/my-project-1.0-SNAPSHOT-jar-with-dependencies.jar.

    name: my-project
    runtime:
        name: java
        options:
            binary: target/my-project-1.0-SNAPSHOT-jar-with-dependencies.jar
    description: A precompiled Java Pulumi program
    
  • A Pulumi.yaml file for a YAML program that includes its resources inline.

    name: my-project
    runtime: yaml
    resources:
      bucket:
        type: aws:s3:Bucket
    

For more information on valid Pulumi project metadata, see Pulumi Configuration Reference.

Paths

When your Pulumi program references resources in the local filesystem, they are always relative to the working directory. The following example code references a subfolder app of the working directory, which would contain a Dockerfile and application code:

const myTask = new cloud.Task("myTask", {
    build: "./app", // subfolder of working directory
    ...
});
const myTask = new cloud.Task("myTask", {
    build: "./app", // subfolder of working directory
    ...
});
myTask = Task('myTask',
    spec={
        'build': './app' # subfolder of working directory
        ...
    }
)
var myTask = new Task("myTask", new TaskArgs
{
    Build = "./app", // subfolder of working directory
    ...
});
var myTask = new Task("myTask",
    TaskArgs.builder()
    .build("./app") // subfolder of working directory.
    .build()); // Java overloading handles ambiguity since the arguments are different
resources:
  myTask:
    type: cloud:Task
    properties:
      build: ./app # subfolder of working directory
      ...

Getting the Current Project Programmatically

The getProject getProject get_project context.Project Deployment.ProjectName function returns the name of the currently deploying project. This can be useful for naming or tagging resources.

let project = pulumi.getProject();
let project = pulumi.getProject();
project = pulumi.get_project()
project := ctx.Project()
var project = Deployment.Instance.ProjectName;
var project = ctx.projectName();
variables:
    project: ${pulumi.project}

Stack Settings Files

Each stack that is created in a project will have a file named Pulumi.<stackname>.yaml that contains the configuration specific to this stack. This file typically resides in the root of the project directory.

For stacks that are actively developed by multiple members of a team, the recommended practice is to check them into source control as a means of collaboration. Since secret values are encrypted, it is safe to check in these stack settings.

When using ephemeral stacks, the stack settings are typically not checked into source control.

For more information about configuration and how this file is managed using the CLI and programming model, refer to Configuration.