1. Docs
  2. Pulumi Cloud
  3. Pulumi Cloud REST API
  4. Environments

Environments

    Pulumi ESC (Environments, Secrets, and Configuration) provides a centralized way to manage infrastructure configuration. The Environments API allows you to create, manage, and use environments for your Pulumi deployments.

    Pulumi ESC and its associated REST API endpoints are currently in public preview.

    Environment Operations

    The API provides endpoints for the following operations:

    • Listing available environments
    • Creating new environments
    • Retrieving, updating, and deleting environments
    • Opening environments to access their values
    • Cloning environments

    List Environments

    List environments available to the authenticated user.

    GET /api/esc/environments/{organization}
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    continuationTokenstringqueryOptional. the continuation token to use for retrieving the next set of results if results were truncated

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      https://api.pulumi.com/api/esc/environments/{organization}
    

    Default response

    Status: 200 OK
    
    {
        "environments": [
            {
                "organization": "{organization}",
                "project": "my-first-project",
                "name": "my-first-environment",
                "created": "2023-10-10 11:28:01",
                "modified" :"2023-10-10 12:24:03"
            }
        ]
    }
    

    Create Environment

    Create a new environment.

    POST /api/esc/environments/{organization}
    

    Body

    KeyTypeInDescription
    projectstringpathproject name
    namestringpathenvironment name

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request POST \
      https://api.pulumi.com/api/esc/environments/{organization}/{environment}
    

    Get Environment

    Retrieve an environment’s details.

    GET /api/esc/environments/{organization}/{project}/{environment}
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request GET \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}
    

    Default response

    Status: 200 OK
    
    {
      "values:
        aws:
          creds:
            fn::open::aws-login:
              oidc:
                duration: 1h
                roleArn: arn:aws:iam::12345678900:role/my-environments-oidc
                sessionName: my-environments-session
        environmentVariables:
          AWS_ACCESS_KEY_ID: ${aws.creds.accessKeyId}
          AWS_SECRET_ACCESS_KEY: ${aws.creds.secretAccessKey}
          AWS_SESSION_TOKEN: ${aws.creds.sessionToken}"
    }
    

    Update Environment

    Update an existing environment.

    PATCH /api/esc/environments/{organization}/{project}/{environment}
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request PATCH \
      --data '<yaml content>' \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}
    

    Delete Environment

    Delete an environment.

    DELETE /api/esc/environments/{organization}/{project}/{environment}
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request DELETE \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}
    

    Open Environment

    Open an environment to access its resolved values.

    POST /api/esc/environments/{organization}/{project}/{environment}/open
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name
    durationstringqueryOptional. open duration - A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request POST \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}/open
    

    Default response

    Status: 200 OK
    
    {
      "id": 1234567,
      "diagnostics": ""
    }
    

    Read Open Environment

    Read values from an opened environment.

    GET /api/esc/environments/{organization}/{project}/{environment}/open/{openSessionID}
    

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name
    openSessionIDstringpathopen session id
    propertystringqueryOptional. path to a specific property

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request GET \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}/open/{openSessionID}
    

    Default response

    Status: 200 OK
    
    "values":
      "aws":
        "creds":
          "accessKeyId": "<redacted>",
          "secretAccessKey": "<redacted>",
          "sessionToken": "<redacted>",
      "environmentVariables":
        "AWS_ACCESS_KEY_ID": "<redacted>",
        "AWS_SECRET_ACCESS_KEY": "<redacted>",
        "AWS_SESSION_TOKEN": "<redacted>""
    

    Clone Environment

    Clone an environment to create a copy.

    POST /api/esc/environments/{organization}/{project}/{environment}/clone
    

    Body

    KeyTypeInDescription
    projectstringbodynew project name
    namestringbodynew environment name
    preserveAccessboolbodywhether to preserve access permissions
    preserveHistoryboolbodywhether to preserve history
    preserveEnvironmentTagsboolbodywhether to preserve environment tags
    preserveRevisionTagsboolbodywhether to preserve version tags

    Parameters

    ParameterTypeInDescription
    organizationstringpathorganization name
    projectstringpathproject name
    environmentstringpathenvironment name

    Example

    curl \
      -H "Accept: application/vnd.pulumi+8" \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      --request POST \
      https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment}/clone