---
title: "POST /v1/{+parent}/previews"
method: POST
path: "/v1/{+parent}/previews"
tags: ["projects"]
---

# POST /v1/{+parent}/previews

`POST /v1/{+parent}/previews`

Creates a Preview.

## Path parameters

- `parent` string, required

## Query parameters

- `previewId` string
- `requestId` string

## Request body

- 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.
  - `terraformBlueprint` TerraformBlueprint — TerraformBlueprint describes the source of a Terraform root module which describes the resources and configs to be deployed.
    - `gcsSource` string — URI of an object in Google Cloud Storage. Format: `gs://{bucket}/{object}` URI may also specify an object version for zipped objects. Format: `gs://{bucket}/{object}#{version}`
    - `gitSource` GitSource — A set of files in a Git repository.
      - `repo` string — Repository URL. Example: 'https://github.com/kubernetes/examples.git'
      - `directory` string — Subdirectory inside the repository. Example: 'staging/my-package'
      - `ref` string — Git reference (e.g. branch or tag).
    - `inputValues` object — Optional. Input variable values for the Terraform blueprint.
    - `externalValues` object — Optional. Map of input variable names in this blueprint to configurations for importing values from external sources.
  - `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, google-datetime — Output only. Time the preview was created.
  - `labels` object — Optional. User-defined labels for the preview.
  - `state` 'STATE_UNSPECIFIED' | 'CREATING' | 'SUCCEEDED' | 'APPLYING' | 'STALE' | 'DELETING' | 'FAILED' | 'DELETED' — 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` 'PREVIEW_MODE_UNSPECIFIED' | 'DEFAULT' | 'DELETE' — 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}`
  - `artifactsGcsBucket` string — 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.
  - `workerPool` string — 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.
  - `errorCode` 'ERROR_CODE_UNSPECIFIED' | 'CLOUD_BUILD_PERMISSION_DENIED' | 'BUCKET_CREATION_PERMISSION_DENIED' | 'BUCKET_CREATION_FAILED' | 'DEPLOYMENT_LOCK_ACQUIRE_FAILED' | 'PREVIEW_BUILD_API_FAILED' | 'PREVIEW_BUILD_RUN_FAILED' | 'EXTERNAL_VALUE_SOURCE_IMPORT_FAILED' — Output only. Code describing any errors that may have occurred.
  - `errorStatus` Status — The `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](https://github.com/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](https://cloud.google.com/apis/design/errors).
    - `code` integer — The status code, which should be an enum value of google.rpc.Code.
    - `message` string — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
    - `details` object[] — A list of messages that carry the error details. There is a common set of message types for APIs to use.
  - `build` string — Output only. Cloud Build instance UUID associated with this preview.
  - `tfErrors` 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.
    - `resourceAddress` string — Address of the resource associated with the error, e.g. `google_compute_network.vpc_network`.
    - `httpResponseCode` integer — HTTP response code returned from Google Cloud Platform APIs when Terraform fails to provision the resource. If unset or 0, no HTTP response code was returned by Terraform.
    - `errorDescription` string — A human-readable error description.
    - `error` Status — The `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](https://github.com/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](https://cloud.google.com/apis/design/errors).
      - `code` integer — The status code, which should be an enum value of google.rpc.Code.
      - `message` string — A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
      - `details` object[] — A list of messages that carry the error details. There is a common set of message types for APIs to use.
  - `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` PreviewArtifacts — Artifacts created by preview.
    - `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}`
  - `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".
  - `tfVersionConstraint` string — The user-specified Terraform version constraint. Example: "=1.3.10".
  - `annotations` object — Optional. 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.
  - `providerConfig` ProviderConfig — ProviderConfig contains the provider configurations.
    - `sourceType` 'PROVIDER_SOURCE_UNSPECIFIED' | 'SERVICE_MAINTAINED' — Optional. ProviderSource specifies the source type of the provider.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/config.md) · [All operations](https://skmtc.net/google/apis/config/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/config/versions/22109f23b9eb/schema)
