- NAME
-
- gcloud infra-manager previews create - create a preview
- SYNOPSIS
-
-
gcloud infra-manager previews create[PREVIEW] [--annotations=[KEY=VALUE, …]] [--artifacts-gcs-bucket=ARTIFACTS_GCS_BUCKET] [--async] [--deployment=DEPLOYMENT] [--labels=[KEY=VALUE, …]] [--location=LOCATION] [--preview-mode=PREVIEW_MODE] [--service-account=SERVICE_ACCOUNT] [--tf-version-constraint=TF_VERSION_CONSTRAINT] [--worker-pool=WORKER_POOL] [--gcs-source=GCS_SOURCE|--git-source-directory=GIT_SOURCE_DIRECTORY--git-source-ref=GIT_SOURCE_REF--git-source-repo=GIT_SOURCE_REPO|--ignore-file=IGNORE_FILE--local-source=LOCAL_SOURCE--input-values=[KEY=VALUE, …] |--inputs-file=INPUTS_FILE] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- This command creates a preview.
- EXAMPLES
- Create a preview named
my-previewfrom a storagemy-bucket:gcloud infra-manager previews create projects/p1/locations/us-central1/previews/my-preview --gcs-source = "gs://my-bucket" --input-values = "project=p1,region=us-central1"Create a preview named
my-previewfrom git repo "https://github.com/examples/repository.git", "staging/compute" folder, "mainline" branch:gcloud infra-manager previews create projects/p1/locations/us-central1/previews/my-preview --git-source-repo = "https://github.com/examples/repository.git" --git-source-directory = "staging/compute" --git-source-ref = "mainline" - POSITIONAL ARGUMENTS
-
- Preview resource - the preview to be used as parent. It is optional and will be
generated if not specified with a fully specified name. This represents a Cloud
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
To set the
projectattribute:- provide the argument
PREVIEWon the command line with a fully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
To set the
locationattribute:- provide the argument
PREVIEWon the command line with a fully specified name; - provide the argument
--locationon the command line; - set the property
infra-manager/location.
- provide the argument
-
PREVIEW - ID of the preview or fully qualified identifier for the preview.
To set the
previewattribute:- provide the argument
PREVIEWon the command line.
- provide the argument
- Preview resource - the preview to be used as parent. It is optional and will be
generated if not specified with a fully specified name. This represents a Cloud
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
- FLAGS
-
-
--annotations=[KEY=VALUE,…] - Preview annotations cannot be updated after creation.
-
--artifacts-gcs-bucket=ARTIFACTS_GCS_BUCKET - user-defined location of Cloud Build logs, artifacts, and Terraform state files
in Google Cloud Storage. Format:
gs://{bucket}/{folder}A default bucket will be bootstrapped if the field is not set or empty -
--async - Return immediately, without waiting for the operation in progress to complete.
-
--deployment=DEPLOYMENT - Deployment reference for preview.
-
--labels=[KEY=VALUE,…] - Preview labels cannot be updated after creation.
- Location resource - the location to be used as parent. This represents a Cloud
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
To set the
projectattribute:- provide the argument
--locationon the command line with a fully specified name; - set the property
infra-manager/locationwith a fully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
- provide the argument
-
--location=LOCATION - ID of the location or fully qualified identifier for the location.
To set the
locationattribute:- provide the argument
--locationon the command line; - set the property
infra-manager/location.
- provide the argument
-
--preview-mode=PREVIEW_MODE - Preview mode to set it to either default or delete.
-
--service-account=SERVICE_ACCOUNT - User-specified Service Account (SA) to be used as credential to manage
resources. Format:
projects/{projectID}/serviceAccounts/{serviceAccount} -
--tf-version-constraint=TF_VERSION_CONSTRAINT - User-specified Terraform version constraint, for example "=1.3.10".
-
--worker-pool=WORKER_POOL - User-specified Worker Pool resource in which the Cloud Build job will execute. Format: projects/{project}/locations/{location}/workerPools/{workerPoolId}
- At most one of these can be specified:
-
--gcs-source=GCS_SOURCE - URI of an object in Google Cloud Storage. e.g.
gs://{bucket}/{object}Examples:
Create a deployment from a storage my-bucket:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --gcs-source = "gs://my-bucket" - Or at least one of these can be specified:
-
--git-source-directory=GIT_SOURCE_DIRECTORY - Subdirectory inside the repository. Example: 'staging/my-package'
Use in conjunction with
--git-source-repoand--git-source-refExamples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --git-source-repo = "https://github.com/examples/repository.git"--git-source-directory = "staging/compute" --git-source-ref = "mainline" -
--git-source-ref=GIT_SOURCE_REF - Subdirectory inside the repository. Example: 'staging/my-package'
Use in conjunction with
--git-source-repoand--git-source-directoryExamples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --git-source-repo = "https://github.com/examples/repository.git"--git-source-directory = "staging/compute" --git-source-ref = "mainline" -
--git-source-repo=GIT_SOURCE_REPO - Repository URL. Example: 'https://github.com/examples/repository.git'
Use in conjunction with
--git-source-directoryand--git-source_refExamples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --git-source-repo = "https://github.com/examples/repository.git"--git-source-directory = "staging/compute" --git-source-ref = "mainline"
-
- Or at least one of these can be specified:
-
--ignore-file=IGNORE_FILE - Override the
.gcloudignorefile and use the specified file instead. Seegcloud topic gcloudignorefor more information. -
--local-source=LOCAL_SOURCE - Local storage path where config files are stored. When using this option,
Terraform config file references outside this storage path is not supported.
e.g.
./path/to/blueprintExamples:
Create a deployment from a local storage path
./path/to/blueprint:gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --local-source = "./path/to/blueprint"
-
-
- At most one of these can be specified:
-
--input-values=[KEY=VALUE,…] - Input variable values for the Terraform blueprint. It only accepts (key, value)
pairs where value is a scalar value.
Examples:
Pass input values on command line:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --gcs-source = "gs://my-bucket" --input-values = projects = p1,region = r -
--inputs-file=INPUTS_FILE - A .tfvars file containing terraform variable values. --inputs-file flag is
supported for python version 3.6 and above.
Examples:
Pass input values on the command line:
gcloud infra-manager previews create projects/p1/location/us-central1/deployments/my-deployment --gcs-source = "gs://my-bucket" --inputs-file = path-to-tfvar-file.tfvar
-
-
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details.
gcloud infra-manager previews create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.

