Skip to main content

deployments

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

Overview

Namedeployments
TypeResource
Idgoogle.config.deployments

Fields

NameDatatypeDescription
namestringResource 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
createTimestringOutput 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}.
deleteResultsobjectOutputs and artifacts from applying a deployment.
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.
labelsobjectUser-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.
quotaValidationstringOptional. Input to control quota checks for resources in terraform configuration files. There are limited resources on which quota validation applies.
serviceAccountstringOptional. 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.
terraformBlueprintobjectTerraformBlueprint describes the source of a Terraform root module which describes the resources and configs to be deployed.
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".
updateTimestringOutput 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

NameAccessible byRequired ParamsDescription
getSELECTdeploymentsId, locationsId, projectsIdGets details about a Deployment.
listSELECTlocationsId, projectsIdLists Deployments in a given project and location.
createINSERTlocationsId, projectsIdCreates a Deployment.
deleteDELETEdeploymentsId, locationsId, projectsIdDeletes a Deployment.
patchUPDATEdeploymentsId, locationsId, projectsIdUpdates a Deployment.
export_lockEXECdeploymentsId, locationsId, projectsIdExports the lock info on a locked deployment.
export_stateEXECdeploymentsId, locationsId, projectsIdExports Terraform state file from a given deployment.
import_stateEXECdeploymentsId, locationsId, projectsIdImports Terraform state file in a given deployment. The state file does not take effect until the Deployment has been unlocked.
lockEXECdeploymentsId, locationsId, projectsIdLocks a deployment.
unlockEXECdeploymentsId, locationsId, projectsIdUnlocks a locked deployment.

SELECT examples

Lists Deployments in a given project and location.

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

INSERT example

Use the following StackQL query and manifest file to create a new deployments resource.

/*+ create */
INSERT INTO google.config.deployments (
locationsId,
projectsId,
terraformBlueprint,
name,
labels,
artifactsGcsBucket,
serviceAccount,
importExistingResources,
workerPool,
tfVersionConstraint,
quotaValidation,
annotations
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ terraformBlueprint }}',
'{{ name }}',
'{{ labels }}',
'{{ artifactsGcsBucket }}',
'{{ serviceAccount }}',
{{ importExistingResources }},
'{{ workerPool }}',
'{{ tfVersionConstraint }}',
'{{ quotaValidation }}',
'{{ annotations }}'
;

UPDATE example

Updates a deployments resource.

/*+ update */
UPDATE google.config.deployments
SET
terraformBlueprint = '{{ terraformBlueprint }}',
name = '{{ name }}',
labels = '{{ labels }}',
artifactsGcsBucket = '{{ artifactsGcsBucket }}',
serviceAccount = '{{ serviceAccount }}',
importExistingResources = true|false,
workerPool = '{{ workerPool }}',
tfVersionConstraint = '{{ tfVersionConstraint }}',
quotaValidation = '{{ quotaValidation }}',
annotations = '{{ annotations }}'
WHERE
deploymentsId = '{{ deploymentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified deployments resource.

/*+ delete */
DELETE FROM google.config.deployments
WHERE deploymentsId = '{{ deploymentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';