REST Resource: projects.locations.previews

Resource: Preview

A preview represents a set of actions Infra Manager would perform to move the resources towards the desired state as specified in the configuration.

JSON representation
{
  "name": string,
  "createTime": string,
  "labels": {
    string: string,
    ...
  },
  "state": enum (State),
  "deployment": string,
  "previewMode": enum (PreviewMode),
  "serviceAccount": string,
  "errorCode": enum (ErrorCode),
  "errorStatus": {
    object (Status)
  },
  "build": string,
  "tfErrors": [
    {
      object (TerraformError)
    }
  ],
  "errorLogs": string,
  "previewArtifacts": {
    object (PreviewArtifacts)
  },
  "logs": string,
  "tfVersion": string,
  "annotations": {
    string: string,
    ...
  },

  // Union field blueprint can be only one of the following:
  "terraformBlueprint": {
    object (TerraformBlueprint)
  }
  // End of list of possible types for union field blueprint.
  "artifactsGcsBucket": string,
  "workerPool": string,
  "tfVersionConstraint": string
}
Fields
name

string

Identifier. Resource name of the preview. Resource name can be user provided or server generated ID if unspecified. Format: projects/{project}/locations/{location}/previews/{preview}

createTime

string (Timestamp format)

Output only. Time the preview was created.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

labels

map (key: string, value: string)

Optional. User-defined labels for the preview.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

state

enum (State)

Output only. Current state of the preview.

deployment

string

Optional. 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.

previewMode

enum (PreviewMode)

Optional. Current mode of preview.

serviceAccount

string

Required. User-specified Service Account (SA) credentials to be used when previewing resources. Format: projects/{projectID}/serviceAccounts/{serviceAccount}

errorCode

enum (ErrorCode)

Output only. Code describing any errors that may have occurred.

errorStatus

object (Status)

Output only. Additional information regarding the current state.

build

string

Output only. Cloud Build instance UUID associated with this preview.

tfErrors[]

object (TerraformError)

Output 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.

errorLogs

string

Output only. Link to tf-error.ndjson file, which contains the full list of the errors encountered during a Terraform preview. Format: gs://{bucket}/{object}.

previewArtifacts

object (PreviewArtifacts)

Output only. Artifacts from preview.

logs

string

Output only. Location of preview logs in gs://{bucket}/{object} format.

tfVersion

string

Output only. The current Terraform version set on the preview. It is in the format of "Major.Minor.Patch", for example, "1.3.10".

annotations

map (key: string, value: string)

Optional. 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.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Union field blueprint. Blueprint to preview. blueprint can be only one of the following:
terraformBlueprint

object (TerraformBlueprint)

The terraform blueprint to preview.

artifactsGcsBucket

string

Optional. 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://<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 If omitted and deployment resource ref provided has artifactsGcsBucket defined, that artifact bucket is used.

workerPool

string

Optional. 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 workerPool defined, that worker pool is used.

tfVersionConstraint

string

Optional. The user-specified Terraform version constraint. Example: "=1.3.10".

State

Possible states of a preview.

Enums
STATE_UNSPECIFIED The default value. This value is used if the state is unknown.
CREATING The preview is being created.
SUCCEEDED The preview has succeeded.
APPLYING The preview is being applied.
STALE The preview is stale. A preview can become stale if a revision has been applied after this preview was created.
DELETING The preview is being deleted.
FAILED The preview has encountered an unexpected error.
DELETED The preview has been deleted.

PreviewMode

Preview mode provides options for customizing preview operations.

Enums
PREVIEW_MODE_UNSPECIFIED Unspecified policy, default mode will be used.
DEFAULT DEFAULT mode generates an execution plan for reconciling current resource state into expected resource state.
DELETE DELETE mode generates as execution plan for destroying current resources.

ErrorCode

Possible errors that can occur with previews.

Enums
ERROR_CODE_UNSPECIFIED No error code was specified.
CLOUD_BUILD_PERMISSION_DENIED Cloud Build failed due to a permissions issue.
BUCKET_CREATION_PERMISSION_DENIED Cloud Storage bucket failed to create due to a permissions issue.
BUCKET_CREATION_FAILED Cloud Storage bucket failed for a non-permissions-related issue.
DEPLOYMENT_LOCK_ACQUIRE_FAILED Acquiring lock on provided deployment reference failed.
PREVIEW_BUILD_API_FAILED Preview encountered an error when trying to access Cloud Build API.
PREVIEW_BUILD_RUN_FAILED Preview created a build but build failed and logs were generated.

PreviewArtifacts

Artifacts created by preview.

JSON representation
{
  "content": string,
  "artifacts": string
}
Fields
content

string

Output only. Location of a blueprint copy and other content in Google Cloud Storage. Format: gs://{bucket}/{object}

artifacts

string

Output only. Location of artifacts in Google Cloud Storage. Format: gs://{bucket}/{object}

Methods

create

Creates a Preview.

delete

Deletes a Preview.

export

Export Preview results.

get

Gets details about a Preview.

list

Lists Previews in a given project and location.