# REST Resource: projects.locations.deployments

- [Resource: Deployment](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment)
  - [JSON representation](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment.SCHEMA_REPRESENTATION)
- [State](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#State)
- [ErrorCode](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#ErrorCode)
- [LockState](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#LockState)
- [Methods](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#METHODS_SUMMARY)

## Resource: Deployment

A Deployment is a group of resources and configs managed and provisioned by Infra Manager.

| JSON representation |
|---|
| ``` { "name": string, "createTime": string, "updateTime": string, "labels": { string: string, ... }, "state": enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#State`), "latestRevision": string, "stateDetail": string, "errorCode": enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#ErrorCode`), "deleteResults": { object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/ApplyResults`) }, "deleteBuild": string, "deleteLogs": string, "tfErrors": [ { object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/TerraformError`) } ], "errorLogs": string, "lockState": enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#LockState`), "tfVersion": string, "quotaValidation": enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/QuotaValidation`), "annotations": { string: string, ... }, "providerConfig": { object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/ProviderConfig`) }, // Union field `blueprint` can be only one of the following: "terraformBlueprint": { object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/TerraformBlueprint`) } // End of list of possible types for union field `blueprint`. "artifactsGcsBucket": string, "serviceAccount": string, "importExistingResources": boolean, "workerPool": string, "tfVersionConstraint": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. Resource name of the deployment. Format: `projects/{project}/locations/{location}/deployments/{deployment}` |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time when the deployment was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time when the deployment was last modified. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `labels` | `map (key: string, value: string)` Optional. User-defined metadata for the deployment. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `state` | ``enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#State`)`` Output only. Current state of the deployment. |
| `latestRevision` | `string` Output only. Revision name that was most recently applied. Format: `projects/{project}/locations/{location}/deployments/{deployment}/ revisions/{revision}` |
| `stateDetail` | `string` Output only. Additional information regarding the current state. |
| `errorCode` | ``enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#ErrorCode`)`` Output only. Error code describing errors that may have occurred. |
| `deleteResults` | ``object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/ApplyResults`)`` Output only. Location of artifacts from a deployments.delete operation. |
| `deleteBuild` | `string` Output only. Cloud Build instance UUID associated with deleting this deployment. |
| `deleteLogs` | `string` Output only. Location of Cloud Build logs in Google Cloud Storage, populated when deleting this deployment. Format: `gs://{bucket}/{object}`. |
| `tfErrors[]` | ``object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/TerraformError`)`` Output only. Errors encountered when deleting this deployment. Errors are truncated to 10 entries, see `deleteResults` and `errorLogs` for full details. |
| `errorLogs` | `string` Output only. Location of Terraform error logs in Google Cloud Storage. Format: `gs://{bucket}/{object}`. |
| `lockState` | ``enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#LockState`)`` Output only. Current lock state of the deployment. |
| `tfVersion` | `string` Output only. The current Terraform version set on the deployment. It is in the format of "Major.Minor.Patch", for example, "1.3.10". |
| `quotaValidation` | ``enum (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/QuotaValidation`)`` Optional. Input to control quota checks for resources in terraform configuration files. There are limited resources on which quota validation applies. |
| `annotations` | `map (key: string, value: string)` Optional. Arbitrary key-value metadata storage e.g. to help client tools identify deployments during automation. See <https://google.aip.dev/148#annotations> for details on format and size limitations. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `providerConfig` | ``object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/ProviderConfig`)`` Optional. This field specifies the provider configurations. |
| Union field `blueprint`. Blueprint to deploy. `blueprint` can be only one of the following: ||
| `terraformBlueprint` | ``object (`https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/TerraformBlueprint`)`` A blueprint described using Terraform's HashiCorp Configuration Language as a root module. |
| `artifactsGcsBucket` | `string` Optional. User-defined location of Cloud Build logs and artifacts in Google Cloud Storage. Format: `gs://{bucket}/{folder}` A default bucket will be bootstrapped if the field is not set or empty. Default bucket format: `gs://<project number>-<region>-blueprint-config` Constraints: - The bucket needs to be in the same project as the deployment - The path cannot be within the path of `gcsSource` - The field cannot be updated, including changing its presence |
| `serviceAccount` | `string` Required. User-specified Service Account (SA) credentials to be used when actuating resources. Format: `projects/{projectID}/serviceAccounts/{serviceAccount}` |
| `importExistingResources` | `boolean` By default, Infra Manager will return a failure when Terraform encounters a 409 code (resource conflict error) during actuation. If this flag is set to true, Infra Manager will instead attempt to automatically import the resource into the Terraform state (for supported resource types) and continue actuation. Not all resource types are supported, refer to documentation. |
| `workerPool` | `string` Optional. The user-specified Cloud Build worker pool resource in which the Cloud Build job will execute. Format: `projects/{project}/locations/{location}/workerPools/{workerPoolId}`. If this field is unspecified, the default Cloud Build worker pool will be used. |
| `tfVersionConstraint` | `string` Optional. The user-specified Terraform version constraint. Example: "=1.3.10". |

## State

Possible states of a deployment.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | The default value. This value is used if the state is omitted. |
| `CREATING` | The deployment is being created. |
| `ACTIVE` | The deployment is healthy. |
| `UPDATING` | The deployment is being updated. |
| `DELETING` | The deployment is being deleted. |
| `FAILED` | The deployment has encountered an unexpected error. |
| `SUSPENDED` | The deployment is no longer being actively reconciled. This may be the result of recovering the project after deletion. |
| `DELETED` | The deployment has been deleted. |

## ErrorCode

Possible errors that can occur with deployments.

| Enums ||
|---|---|
| `ERROR_CODE_UNSPECIFIED` | No error code was specified. |
| `REVISION_FAILED` | The revision failed. See Revision for more details. |
| `CLOUD_BUILD_PERMISSION_DENIED` | Cloud Build failed due to a permission issue. |
| `DELETE_BUILD_API_FAILED` | Cloud Build job associated with a deployment deletion could not be started. |
| `DELETE_BUILD_RUN_FAILED` | Cloud Build job associated with a deployment deletion was started but failed. |
| `BUCKET_CREATION_PERMISSION_DENIED` | Cloud Storage bucket creation failed due to a permission issue. |
| `BUCKET_CREATION_FAILED` | Cloud Storage bucket creation failed due to an issue unrelated to permissions. |
| `EXTERNAL_VALUE_SOURCE_IMPORT_FAILED` | Failed to import values from an external source. |

## LockState

Possible lock states of a deployment.

| Enums ||
|---|---|
| `LOCK_STATE_UNSPECIFIED` | The default value. This value is used if the lock state is omitted. |
| `LOCKED` | The deployment is locked. |
| `UNLOCKED` | The deployment is unlocked. |
| `LOCKING` | The deployment is being locked. |
| `UNLOCKING` | The deployment is being unlocked. |
| `LOCK_FAILED` | The deployment has failed to lock. |
| `UNLOCK_FAILED` | The deployment has failed to unlock. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/create` | Creates a `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment`. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/delete` | Deletes a `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment`. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/deleteState` | Deletes Terraform state file in a given deployment. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportLock` | Exports the lock info on a locked deployment. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState` | Exports Terraform state file from a given deployment. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/get` | Gets details about a `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment`. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/getIamPolicy` | Gets the access control policy for a resource. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/importState` | Imports Terraform state file in a given deployment. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/list` | Lists `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment`s in a given project and location. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/lock` | Locks a deployment. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/patch` | Updates a `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments#Deployment`. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/setIamPolicy` | Sets the access control policy on the specified resource. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/testIamPermissions` | Returns permissions that a caller has on the specified resource. |
| ### `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/unlock` | Unlocks a locked deployment. |