This page describes deployments and revisions, including the following:

- List of metadata stored for each deployment.
- The format of the deployment name and revision name.

## Deployments

Infra Manager provisions resources onto Google Cloud as a deployment.

A deployment can provision Google Cloud resources to multiple locations and
to multiple projects. Note that:

- The specific resources need to be available in the locations. For example, see [Cloud Run locations](https://docs.cloud.google.com/run/docs/locations.md.txt) for the list of locations where Cloud Run is available.
- The service account must have the permissions that are required to deploy to the specified projects. For details, see [Configure the service account](https://docs.cloud.google.com/infrastructure-manager/docs/configure-service-account.md.txt).

### Deployment metadata

Infra Manager creates a storage bucket in the project and location
where Infra Manager is run. After the deployment is created, the
Infrastructure Manager artifacts are in this storage bucket which has the name:
`gs://PROJECT_NUMBER-LOCATION-blueprint-config`.

For deployments created in a multi-region, this storage bucket is created with
multi-regional redundancy. For example, if a deployment is created in the `us`
multi-region, then the storage bucket is created across data centers in the
United States.

Infra Manager uses the term *blueprint* to refer to a
Terraform configuration.

Where you replace the following:

- <var translate="no">PROJECT_ID</var>: the project ID where Infra Manager is run.
- <var translate="no">LOCATION</var>: the location where Infra Manager is run.

The deployment artifacts in the storage bucket include:

- Cloud Build logs.
- Terraform logs.
- A copy of the Terraform configuration.

Infra Manager also stores a copy of the Terraform state file. For
details about the state file, including accessing the file, see
[Manage the Terraform state file](https://docs.cloud.google.com/infrastructure-manager/docs/state-file.md.txt).

Revisions are versions of a deployment, so Infra Manager stores
this deployment metadata for each revision.

### Deployment ID

The deployment ID is the user-specified identifier for a deployment resource.
Use the deployment ID to refer to a deployment using the format:

```bash
projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID
```

Replace the following:

- <var translate="no">PROJECT_ID</var> is the project ID where Infra Manager runs.
- <var translate="no">LOCATION</var> is the location where Infra Manager runs. See [Infrastructure Manager locations](https://docs.cloud.google.com/infrastructure-manager/docs/locations.md.txt) for the list of valid locations.
- <var translate="no">DEPLOYMENT_ID</var> is the deployment ID, which is a user-specified name. This ID must:
  - Contain only lowercase letters, numbers, or hyphens.
  - Start with a lowercase letter.
  - End with a number or lowercase letter
  - Cannot be the string `archived-deployments` or `archived-previews`
  - Must be unique within the project and location where Infra Manager is run.

For example:

```bash
projects/my-project/locations/us-central1/deployments/my-deployment
```

## Revisions

Revisions are versions of a deployment. When you initially create a
deployment, this deployment is also a revisions and has the revision ID `r-0`.

### Revision name

When you create an Infra Manager deployment, it is automatically given the
revision identifier `r-0`. If you update the deployment, then Infrastructure Manager
creates a new revision with identifier `r-1`. For every new revision,
the identifier increases by one. The revision identifier can only be set
by Infrastructure Manager.

For example, a revision name could be:

```bash
projects/my-project/locations/us-central1/deployments/my-deployment/revisions/r-1
```

## Previews

A preview describes the actions to actuate a specific Terraform configuration.
Before you create a new deployment or update a deployment, you can preview
the deployment to verify the resources that are planned to be provisioned.

### Preview metadata

Infra Manager creates a storage bucket in the project and location
where Infra Manager is run. After the preview is created, the Infra Manager artifacts are in this storage bucket which has the name:
`gs://PROJECT_NUMBER-LOCATION-blueprint-config`.

For a preview of a new deployment, the metadata is organized with a
`new-previews` prefix, for example:
`gs://PROJECT_NUMBER-LOCATION-blueprint-config/new-previews/preview-name`

You can also preview an update to an existing deployment. For these previews
targeting an existing deployment, the artifacts are stored in the same storage
bucket as the deployment artifacts. The storage bucket which has the name:
`gs://PROJECT_ID-LOCATION-blueprint-config/deployment-ID/previews/preview-ID`.

Infrastructure Manager uses the term *blueprint* to refer to a
Terraform configuration.

Replace the following:

- <var translate="no">PROJECT_ID</var>: the project ID where Infra Manager is run.
- <var translate="no">LOCATION</var>: the location where Infra Manager is run.

The preview artifacts in the storage bucket include:

- Cloud Build logs.
- Terraform logs.
- A copy of the Terraform configuration.

### Preview name

The format of the preview name is:

```bash
projects/PROJECT_ID/locations/LOCATION/previews/PREVIEW_ID
```

Where:

- <var translate="no">PROJECT_ID</var> is the project ID where Infra Manager runs.
- <var translate="no">LOCATION</var> is the location where Infra Manager runs. See [Infrastructure Manager locations](https://docs.cloud.google.com/infrastructure-manager/docs/locations.md.txt) for the list of valid locations.
- <var translate="no">PREVIEW_ID</var> is the preview identifier, and is a user-specified name. This name must:
  - Contain only lowercase letters, numbers, or hyphens.
  - Start with a lowercase letter.
  - End with a number or lowercase letter
  - Cannot be the string `archived-deployments` or `archived-previews`
  - Must be unique within the project and location where Infra Manager is run.

For example:

```bash
projects/my-project/locations/us-central1/previews/my-preview
```

## What's next

- Learn more about [Terraform with Google Cloud](https://docs.cloud.google.com/docs/terraform.md.txt).
- [Create a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/deploy-resources.md.txt).
- [Update a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/update-deployment.md.txt).
- [View the state of a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/view-deployments.md.txt).
- [Delete a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/delete-deployments.md.txt).