Skip to main content

previews

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

Overview

Namepreviews
TypeResource
Idgoogle.config.previews

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. Resource name of the preview. Resource name can be user provided or server generated ID if unspecified. Format: projects/{project}/locations/{location}/previews/{preview}
annotationsobjectOptional. Arbitrary key-value metadata storage e.g. to help client tools identify preview during automation. See https://google.aip.dev/148#annotations for details on format and size limitations.
artifactsGcsBucketstringOptional. User-defined location of Cloud Build logs, artifacts, and 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 If omitted and deployment resource ref provided has artifacts_gcs_bucket defined, that artifact bucket is used.
buildstringOutput only. Cloud Build instance UUID associated with this preview.
createTimestring (google-datetime)Output only. Time the preview was created.
deploymentstringOptional. Optional deployment reference. If specified, the preview will be performed using the provided deployment's current state and use any relevant fields from the deployment unless explicitly specified in the preview create request.
errorCodestringOutput only. Code describing any errors that may have occurred.
errorLogsstringOutput only. Link to tf-error.ndjson file, which contains the full list of the errors encountered during a Terraform preview. Format: gs://{bucket}/{object}.
errorStatusobjectOutput only. Additional information regarding the current state. (id: Status)
labelsobjectOptional. User-defined labels for the preview.
logsstringOutput only. Location of preview logs in gs://{bucket}/{object} format.
previewArtifactsobjectOutput only. Artifacts from preview. (id: PreviewArtifacts)
previewModestringOptional. Current mode of preview.
providerConfigobjectOptional. This field specifies the provider configurations. (id: ProviderConfig)
serviceAccountstringRequired. User-specified Service Account (SA) credentials to be used when previewing resources. Format: projects/{projectID}/serviceAccounts/{serviceAccount}
statestringOutput only. Current state of the preview.
terraformBlueprintobjectThe terraform blueprint to preview. (id: TerraformBlueprint)
tfErrorsarrayOutput only. Summary of errors encountered during Terraform preview. It has a size limit of 10, i.e. only top 10 errors will be summarized here.
tfVersionstringOutput only. The current Terraform version set on the preview. 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".
workerPoolstringOptional. The user-specified 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. If omitted and deployment resource ref provided has worker_pool defined, that worker pool is used.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, previewsIdGets details about a Preview.
listselectprojectsId, locationsIdpageSize, pageToken, filter, orderByLists Previews in a given project and location.
createinsertprojectsId, locationsIdpreviewId, requestIdCreates a Preview.
deletedeleteprojectsId, locationsId, previewsIdrequestIdDeletes a Preview.
exportexecprojectsId, locationsId, previewsIdExport Preview results.

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
locationsIdstring
previewsIdstring
projectsIdstring
filterstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
previewIdstring
requestIdstring

SELECT examples

Gets details about a Preview.

SELECT
name,
annotations,
artifactsGcsBucket,
build,
createTime,
deployment,
errorCode,
errorLogs,
errorStatus,
labels,
logs,
previewArtifacts,
previewMode,
providerConfig,
serviceAccount,
state,
terraformBlueprint,
tfErrors,
tfVersion,
tfVersionConstraint,
workerPool
FROM google.config.previews
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND previewsId = '{{ previewsId }}' -- required;

INSERT examples

Creates a Preview.

INSERT INTO google.config.previews (
data__terraformBlueprint,
data__name,
data__labels,
data__deployment,
data__previewMode,
data__serviceAccount,
data__artifactsGcsBucket,
data__workerPool,
data__tfVersionConstraint,
data__annotations,
data__providerConfig,
projectsId,
locationsId,
previewId,
requestId
)
SELECT
'{{ terraformBlueprint }}',
'{{ name }}',
'{{ labels }}',
'{{ deployment }}',
'{{ previewMode }}',
'{{ serviceAccount }}',
'{{ artifactsGcsBucket }}',
'{{ workerPool }}',
'{{ tfVersionConstraint }}',
'{{ annotations }}',
'{{ providerConfig }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ previewId }}',
'{{ requestId }}'
RETURNING
name,
done,
error,
metadata,
response
;

DELETE examples

Deletes a Preview.

DELETE FROM google.config.previews
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND previewsId = '{{ previewsId }}' --required
AND requestId = '{{ requestId }}';

Lifecycle Methods

Export Preview results.

EXEC google.config.previews.export 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@previewsId='{{ previewsId }}' --required;