Skip to main content

deployments

Creates, updates, deletes, gets or lists a deployments resource.

Overview

Namedeployments
TypeResource
Idgoogle.config.deployments

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. Resource name of the deployment. Format: projects/{project}/locations/{location}/deployments/{deployment}
annotationsobjectOptional. 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.
artifactsGcsBucketstringOptional. 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://--blueprint-config Constraints: - The bucket needs to be in the same project as the deployment - The path cannot be within the path of gcs_source - The field cannot be updated, including changing its presence
createTimestring (google-datetime)Output only. Time when the deployment was created.
deleteBuildstringOutput only. Cloud Build instance UUID associated with deleting this deployment.
deleteLogsstringOutput only. Location of Cloud Build logs in Google Cloud Storage, populated when deleting this deployment. Format: gs://{bucket}/{object}.
deleteResultsobjectOutput only. Location of artifacts from a DeleteDeployment operation. (id: ApplyResults)
errorCodestringOutput only. Error code describing errors that may have occurred.
errorLogsstringOutput only. Location of Terraform error logs in Google Cloud Storage. Format: gs://{bucket}/{object}.
importExistingResourcesbooleanBy 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.
labelsobjectOptional. User-defined metadata for the deployment.
latestRevisionstringOutput only. Revision name that was most recently applied. Format: projects/{project}/locations/{location}/deployments/{deployment}/ revisions/{revision}
lockStatestringOutput only. Current lock state of the deployment.
providerConfigobjectOptional. This field specifies the provider configurations. (id: ProviderConfig)
quotaValidationstringOptional. Input to control quota checks for resources in terraform configuration files. There are limited resources on which quota validation applies.
serviceAccountstringRequired. User-specified Service Account (SA) credentials to be used when actuating resources. Format: projects/{projectID}/serviceAccounts/{serviceAccount}
statestringOutput only. Current state of the deployment.
stateDetailstringOutput only. Additional information regarding the current state.
terraformBlueprintobjectA blueprint described using Terraform's HashiCorp Configuration Language as a root module. (id: TerraformBlueprint)
tfErrorsarrayOutput only. Errors encountered when deleting this deployment. Errors are truncated to 10 entries, see delete_results and error_logs for full details.
tfVersionstringOutput only. The current Terraform version set on the deployment. It is in the format of "Major.Minor.Patch", for example, "1.3.10".
tfVersionConstraintstringOptional. The user-specified Terraform version constraint. Example: "=1.3.10".
updateTimestring (google-datetime)Output only. Time when the deployment was last modified.
workerPoolstringOptional. 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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, deploymentsIdGets details about a Deployment.
listselectprojectsId, locationsIdpageSize, pageToken, filter, orderByLists Deployments in a given project and location.
createinsertprojectsId, locationsIddeploymentId, requestIdCreates a Deployment.
patchupdateprojectsId, locationsId, deploymentsIdupdateMask, requestIdUpdates a Deployment.
deletedeleteprojectsId, locationsId, deploymentsIdrequestId, force, deletePolicyDeletes a Deployment.
export_stateexecprojectsId, locationsId, deploymentsIdExports Terraform state file from a given deployment.
import_stateexecprojectsId, locationsId, deploymentsIdImports Terraform state file in a given deployment. The state file does not take effect until the Deployment has been unlocked.
delete_stateexecprojectsId, locationsId, deploymentsIdDeletes Terraform state file in a given deployment.
lockexecprojectsId, locationsId, deploymentsIdLocks a deployment.
unlockexecprojectsId, locationsId, deploymentsIdUnlocks a locked deployment.
export_lockexecprojectsId, locationsId, deploymentsIdExports the lock info on a locked deployment.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deploymentsIdstring
locationsIdstring
projectsIdstring
deletePolicystring
deploymentIdstring
filterstring
forceboolean
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets details about a Deployment.

SELECT
name,
annotations,
artifactsGcsBucket,
createTime,
deleteBuild,
deleteLogs,
deleteResults,
errorCode,
errorLogs,
importExistingResources,
labels,
latestRevision,
lockState,
providerConfig,
quotaValidation,
serviceAccount,
state,
stateDetail,
terraformBlueprint,
tfErrors,
tfVersion,
tfVersionConstraint,
updateTime,
workerPool
FROM google.config.deployments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND deploymentsId = '{{ deploymentsId }}' -- required;

INSERT examples

Creates a Deployment.

INSERT INTO google.config.deployments (
data__terraformBlueprint,
data__name,
data__labels,
data__artifactsGcsBucket,
data__serviceAccount,
data__importExistingResources,
data__workerPool,
data__tfVersionConstraint,
data__quotaValidation,
data__annotations,
data__providerConfig,
projectsId,
locationsId,
deploymentId,
requestId
)
SELECT
'{{ terraformBlueprint }}',
'{{ name }}',
'{{ labels }}',
'{{ artifactsGcsBucket }}',
'{{ serviceAccount }}',
{{ importExistingResources }},
'{{ workerPool }}',
'{{ tfVersionConstraint }}',
'{{ quotaValidation }}',
'{{ annotations }}',
'{{ providerConfig }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ deploymentId }}',
'{{ requestId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates a Deployment.

UPDATE google.config.deployments
SET
data__terraformBlueprint = '{{ terraformBlueprint }}',
data__name = '{{ name }}',
data__labels = '{{ labels }}',
data__artifactsGcsBucket = '{{ artifactsGcsBucket }}',
data__serviceAccount = '{{ serviceAccount }}',
data__importExistingResources = {{ importExistingResources }},
data__workerPool = '{{ workerPool }}',
data__tfVersionConstraint = '{{ tfVersionConstraint }}',
data__quotaValidation = '{{ quotaValidation }}',
data__annotations = '{{ annotations }}',
data__providerConfig = '{{ providerConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND deploymentsId = '{{ deploymentsId }}' --required
AND updateMask = '{{ updateMask}}'
AND requestId = '{{ requestId}}'
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Deletes a Deployment.

DELETE FROM google.config.deployments
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND deploymentsId = '{{ deploymentsId }}' --required
AND requestId = '{{ requestId }}'
AND force = '{{ force }}'
AND deletePolicy = '{{ deletePolicy }}';

Lifecycle Methods

Exports Terraform state file from a given deployment.

EXEC google.config.deployments.export_state 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@deploymentsId='{{ deploymentsId }}' --required
@@json=
'{
"draft": {{ draft }}
}';