gcloud infra-manager deployments apply
Stay organized with collections
Save and categorize content based on your preferences.
- NAME
-
- gcloud infra-manager deployments apply - create or update a deployment
- SYNOPSIS
-
-
gcloud infra-manager deployments apply(DEPLOYMENT:--location=LOCATION) [--annotations=[KEY=VALUE,…]] [--artifacts-gcs-bucket=ARTIFACTS_GCS_BUCKET] [--async] [--import-existing-resources] [--labels=[KEY=VALUE,…]] [--quota-validation=QUOTA_VALIDATION] [--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 updates a deployment when it already exists, otherwise the deployment will be created.
- EXAMPLES
-
Create a deployment named
my-deploymentfrom a storagemy-bucket:gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--gcs-source="gs://my-bucket"--input-values="project=p1,region=us-central1"Create a deployment named
my-deploymentfrom git repo "https://github.com/examples/repository.git", "staging/compute" folder, "mainline" branch:gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--git-source-repo="https://github.com/examples/repository.git"--git-source-directory="staging/compute"--git-source-ref="mainline"Update a deployment's labels:
gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--git-source-repo="https://github.com/examples/repository.git"--git-source-directory="staging/compute"--git-source-ref="mainline"--labels="env=prod,team=finance" - POSITIONAL ARGUMENTS
-
-
Deployment resource - the deployment to create or update. The arguments in this
group can be used to specify the attributes of this 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
DEPLOYMENTon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
This must be specified.
DEPLOYMENT-
ID of the deployment or fully qualified identifier for the deployment.
To set the
deploymentattribute:-
provide the argument
DEPLOYMENTon the command line.
This positional argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--location=LOCATION-
The Cloud location for the deployment.
To set the
locationattribute:-
provide the argument
DEPLOYMENTon the command line with a fully specified name; -
provide the argument
--locationon the command line; -
set the property
infra-manager/location.
-
provide the argument
-
provide the argument
-
Deployment resource - the deployment to create or update. The arguments in this
group can be used to specify the attributes of this resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other ways.
- FLAGS
-
--annotations=[KEY=VALUE,…]-
Annotations to apply to the deployment. Existing values are overwritten. To
retain the existing annotations on a deployment, do not specify this flag.
Examples:
Update annotations for an existing deployment:
gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--gcs-source="gs://my-bucket"--annotations="env=prod,team=finance"Clear annotations for an existing deployment:
gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--gcs-source="gs://my-bucket"--annotations=""Add an annotation to an existing deployment:
First,fetchthecurrentannotationsusingthe`describe`command,thenfollowthe precedingexampleforupdatingannotations.
--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.
--import-existing-resources- By default, Infrastructure Manager will return a failure when Terraform encounters a 409 code (resource conflict error) during actuation. If this flag is set to true, Infrastructure Manager will instead attempt to automatically import the resource into the Terraform state (for supported resource types) and continue actuation.
--labels=[KEY=VALUE,…]-
Labels to apply to the deployment. Existing values are overwritten. To retain
the existing labels on a deployment, do not specify this flag.
Examples:
Update labels for an existing deployment:
gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--gcs-source="gs://my-bucket"--labels="env=prod,team=finance"Clear labels for an existing deployment:
gcloudinfra-managerdeploymentsapplyprojects/p1/locations/us-central1/deployments/my-deployment--gcs-source="gs://my-bucket"--labels=""Add a label to an existing deployment:
First,fetchthecurrentlabelsusingthe`describe`command,thenfollowthe precedingexampleforupdatinglabels.
--quota-validation=QUOTA_VALIDATION- Input to control quota checks for resources in terraform configuration files. There are limited resources on which quota validation applies. Supported values are QUOTA_VALIDATION_UNSPECIFIED, ENABLED, ENFORCED
--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:
gcloudinfra-managerdeploymentsapplyprojects/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:
gcloudinfra-managerdeploymentsapplyprojects/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:
gcloudinfra-managerdeploymentsapplyprojects/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:
gcloudinfra-managerdeploymentsapplyprojects/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:gcloudinfra-managerdeploymentsapplyprojects/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:
gcloudinfra-managerdeploymentsapplyprojects/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:
gcloudinfra-managerdeploymentsapplyprojects/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.