Skip to main content

previews

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

Overview

Namepreviews
TypeResource
Idgoogle.config.previews

Fields

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 identifiy 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.
createTimestringOutput 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}.
errorStatusobjectThe Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.
labelsobjectOptional. User-defined labels for the preview.
logsstringOutput only. Location of preview logs in gs://{bucket}/{object} format.
previewArtifactsobjectArtifacts created by preview.
previewModestringOptional. Current mode of preview.
serviceAccountstringOptional. User-specified Service Account (SA) credentials to be used when previewing resources. Format: projects/{projectID}/serviceAccounts/{serviceAccount}
statestringOutput only. Current state of the preview.
terraformBlueprintobjectTerraformBlueprint describes the source of a Terraform root module which describes the resources and configs to be deployed.
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

NameAccessible byRequired ParamsDescription
getSELECTlocationsId, previewsId, projectsIdGets details about a Preview.
listSELECTlocationsId, projectsIdLists Previews in a given project and location.
createINSERTlocationsId, projectsIdCreates a Preview.
deleteDELETElocationsId, previewsId, projectsIdDeletes a Preview.
exportEXEClocationsId, previewsId, projectsIdExport Preview results.

SELECT examples

Lists Previews in a given project and location.

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

INSERT example

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

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

DELETE example

Deletes the specified previews resource.

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