2019-08-23 14:22:47 -07:00
---
2023-06-02 21:41:36 -07:00
title_tag: "Projects | Pulumi Concepts"
2022-12-13 15:19:37 -08:00
meta_desc: A Pulumi project is any folder which contains a Pulumi.yaml file. Learn about how to use Pulumi projects, as well as example use cases.
2023-05-15 15:25:28 -07:00
title: Projects
h1: Projects
2023-06-08 16:15:52 -07:00
meta_image: /images/docs/meta-images/docs-meta.png
2019-08-23 14:22:47 -07:00
menu:
2023-05-15 15:25:28 -07:00
concepts:
identifier: projects
weight: 1
aliases:
- /docs/reference/project/
- /docs/tour/basics-projects/
- /docs/tour/programs/
- /docs/intro/concepts/project/
2019-08-23 14:22:47 -07:00
---
2022-05-03 21:23:32 -07:00
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` .
2019-08-23 14:22:47 -07:00
## Project file {#pulumi-yaml}
2021-02-03 09:30:42 -06:00
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.
2019-08-23 14:22:47 -07:00
A typical `Pulumi.yaml` file looks like the following:
```yaml
name: webserver
runtime: nodejs
description: Basic example of an AWS web server accessible over HTTP.
```
2021-02-03 09:30:42 -06:00
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.
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
The following are other examples of `Pulumi.yaml` files that define project configurations for other use cases:
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
* A `Pulumi.yaml` file for a `nodejs` program that uses JavaScript rather than TypeScript.
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
```yaml
name: my-project
description: A minimal JavaScript Pulumi program.
runtime:
2021-05-10 17:06:30 +01:00
name: nodejs
options:
typescript: false
2021-02-03 09:30:42 -06:00
```
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
* A `Pulumi.yaml` file for a `go` program that will only use a pre-built executable by the name `mybinary` .
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
```yaml
name: my-project
runtime:
name: go
options:
binary: mybinary
description: A minimal Go Pulumi program
```
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
* A `Pulumi.yaml` file for a `dotnet` program that will use a pre-built assembly `MyInfra.dll` under the `bin` directory.
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
```yaml
name: my-project
runtime:
name: dotnet
options:
binary: bin/MyInfra.dll
description: A precompiled .NET Pulumi program
```
2020-11-14 14:01:30 -08:00
2022-05-03 21:23:32 -07:00
* 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` .
```yaml
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.
```yaml
name: my-project
runtime: yaml
resources:
bucket:
type: aws:s3:Bucket
```
2022-10-26 07:22:15 -07:00
For more information on valid Pulumi project metadata, see [Pulumi Configuration Reference ](/docs/reference/pulumi-yaml/ ).
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
## Paths
2019-08-23 14:22:47 -07:00
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:
2022-05-03 21:23:32 -07:00
{{< chooser language " javascript , typescript , python , csharp , java , yaml " > }}
2020-03-20 09:32:19 -07:00
{{% choosable language javascript %}}
2019-08-23 14:22:47 -07:00
```javascript
const myTask = new cloud.Task("myTask", {
build: "./app", // subfolder of working directory
...
});
```
2020-03-20 09:32:19 -07:00
{{% /choosable %}}
{{% choosable language typescript %}}
2019-08-23 14:22:47 -07:00
```typescript
const myTask = new cloud.Task("myTask", {
build: "./app", // subfolder of working directory
...
});
```
2020-03-20 09:32:19 -07:00
{{% /choosable %}}
{{% choosable language python %}}
2019-08-23 14:22:47 -07:00
```python
myTask = Task('myTask',
spec={
'build': './app' # subfolder of working directory
...
}
)
```
2020-04-01 17:55:46 +02:00
{{% /choosable %}}
{{% choosable language csharp %}}
```csharp
var myTask = new Task("myTask", new TaskArgs
{
Build = "./app", // subfolder of working directory
...
});
```
2022-05-03 21:23:32 -07:00
{{% /choosable %}}
{{% choosable language java %}}
```java
var myTask = new Task("myTask",
TaskArgs.builder()
.build("./app") // subfolder of working directory.
.build()); // Java overloading handles ambiguity since the arguments are different
```
{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
resources:
myTask:
type: cloud:Task
properties:
build: ./app # subfolder of working directory
...
```
2020-03-20 09:32:19 -07:00
{{% /choosable %}}
{{< / chooser > }}
2021-02-03 09:30:42 -06:00
## Getting the Current Project Programmatically
The {{< pulumi-getproject > }} function returns the name of the currently deploying project. This can be useful for naming or tagging resources.
2022-05-03 21:23:32 -07:00
{{< chooser language " javascript , typescript , python , go , csharp , java , yaml " > }}
2021-02-03 09:30:42 -06:00
{{% choosable language javascript %}}
```javascript
let project = pulumi.getProject();
```
{{% /choosable %}}
{{% choosable language typescript %}}
```typescript
let project = pulumi.getProject();
```
{{% /choosable %}}
{{% choosable language python %}}
```python
project = pulumi.get_project()
```
{{% /choosable %}}
{{% choosable language go %}}
```go
project := ctx.Project()
```
{{% /choosable %}}
{{% choosable language csharp %}}
```csharp
var project = Deployment.Instance.ProjectName;
```
2022-05-03 21:23:32 -07:00
{{% /choosable %}}
{{% choosable language java %}}
```java
var project = ctx.projectName();
```
{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
variables:
project: ${pulumi.project}
```
2021-02-03 09:30:42 -06:00
{{% /choosable %}}
{{< / chooser > }}
2019-08-26 16:25:20 -07:00
## Stack Settings Files {#stack-settings-file}
2019-08-23 14:22:47 -07:00
2021-02-03 09:30:42 -06:00
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.
2019-08-26 16:25:20 -07:00
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.
2021-02-03 09:30:42 -06:00
When using ephemeral stacks, the stack settings are typically not checked into source control.
2019-08-26 16:25:20 -07:00
2023-05-15 15:25:28 -07:00
For more information about configuration and how this file is managed using the CLI and programming model, refer to [Configuration ](/docs/concepts/config/ ).