# Create a new Project

Pulumi supports several programming languages. The first step is to ask the CLI to bootstrap a basic TypeScript project.

Make a new folder called `pulumi-aks-workshop` anywhere on your local disk. By default, this folder gives a name to your Pulumi project.

### Initialize the project

The `pulumi new` command creates a new Pulumi project with some basic scaffolding based on the cloud and language specified.

```
mkdir pulumi-ask-workshop && cd pulumi-ask-workshop && pulumi new azure-typescript
```

First, you will be asked for a **project name** and **project description**. Hit `ENTER` to accept the default values or specify new values.

```
This command will walk you through creating a new Pulumi project.

Enter a value or leave blank to accept the (default), and press <ENTER>.
Press ^C at any time to quit.

Project name (pulumi-ask-workshop):
Project description (A minimal Azure Native TypeScript Pulumi program):
Created project 'pulumi-ask-workshop'
```

Next, you will be asked for a **stack name**. Hit `ENTER` to accept the default value of `dev`.

```
Please enter your desired stack name.
To create a stack in an organization, use the format <org-name>/<stack-name> (e.g. `acmecorp/dev`).
Stack name (dev): dev
Created stack 'dev'

The package manager to use for installing dependencies  [Use arrows to move, type to filter]
> npm
  yarn
  pnpm [not found]
```

You can choose the package manager likes npm or yarn. The default is npm. Hit ENTER to accept.

For Azure projects, you will be prompted for the Azure location. You can accept the default value of `WestUS` or choose another location. The Azure location will be stored in `Pulumi.dev.yaml` file. I will choose `southeastasia` for now.

{% hint style="info" %}
You also can then change the region for your stack by using the `pulumi config set` command as shown below:

```
pulumi config set azure-native:location eastus
```

{% endhint %}

After some dependency installations, the project and stack will be ready.

```
Your new project is ready to go! ✨

To perform an initial deployment, run `pulumi up`
```

### **Install Dependencies**

Ensure you have the required dependencies installed:

```
npm install @pulumi/kubernetes @pulumi/azure-native @pulumi/tls
```

### Introduction to Pulumi Configuration

Pulumi uses configurations to manage environment-specific settings like credentials, resource options, or feature flags. This makes your infrastructure code adaptable and reusable across different environments (such as **development**, **staging**, and **production**) by applying different configurations for each.

#### Key Concepts in Pulumi Configuration

* **Stack**: A Pulumi stack is an isolated deployment environment for your infrastructure. You can have different stacks for different environments (e.g., `dev`, `staging`, `prod`).
* **Configuration**: Each stack can have its own configuration settings, such as region, instance types, or API keys. These configurations are stored securely and can be referenced within your Pulumi code.
* **Secrets**: Pulumi can securely manage sensitive information, like passwords or API keys, using encrypted secrets.

#### Setting Configuration Values

Pulumi allows you to define configuration values through the command line, which are stored in the stack’s configuration file (e.g., `Pulumi.dev.yaml`, `Pulumi.prod.yaml`).

You can set configuration values using the Pulumi CLI:

```bash
pulumi config set <key> <value>
```

For example, to set the region for an Azure deployment, you can run:

```bash
pulumi config set azure:location southeastasia
```

This will save the location to the stack's configuration file.

You can view the current configuration for a stack:

```bash
pulumi config
```

#### Accessing Configuration in Code

Once a configuration value is set, you can access it in your Pulumi code using the `pulumi.Config` object.

**Example in TypeScript:**

```typescript
import * as pulumi from "@pulumi/pulumi";

// Create a configuration object
const config = new pulumi.Config();

// Access a simple configuration value
const location = config.require("azure:location");

// Use the configuration value in your resource definitions
const resourceGroup = new azure.core.ResourceGroup("myResourceGroup", {
    location: location,
});
```

In this case, `config.require("azure:location")` fetches the value set by `pulumi config set azure:location westus2` and uses it to define the location of the resource group.

* `config.require("<key>")`: Retrieves a configuration value and throws an error if the key is not found.
* `config.get("<key>")`: Retrieves a configuration value and returns `undefined` if the key is not found.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hahoangv.gitbook.io/azure-kubernetes-service/hands-on-provisioning-and-configuring-an-aks-cluster-on-azure-with-pulumi/setup-environment/create-a-new-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
