- 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-deployment
from a storagemy-bucket
:gcloud infra-manager deployments apply projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --input-values="project=p1,region=us-central1"
Create a deployment named
my-deployment
from git repo "https://github.com/examples/repository.git", "staging/compute" folder, "mainline" branch:gcloud infra-manager deployments apply projects/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:
gcloud infra-manager deployments apply projects/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
project
attribute:-
provide the argument
DEPLOYMENT
on the command line with a fully specified name; -
provide the argument
--project
on 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
deployment
attribute:-
provide the argument
DEPLOYMENT
on 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
location
attribute:-
provide the argument
DEPLOYMENT
on the command line with a fully specified name; -
provide the argument
--location
on 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:
gcloud infra-manager deployments apply projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --annotations="env=prod,team=finance"
Clear annotations for an existing deployment:
gcloud infra-manager deployments apply projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --annotations=""
Add an annotation to an existing deployment:
First, fetch the current annotations using the `describe` command, then follow the preceding example for updating annotations.
--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:
gcloud infra-manager deployments apply projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --labels="env=prod,team=finance"
Clear labels for an existing deployment:
gcloud infra-manager deployments apply projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --labels=""
Add a label to an existing deployment:
First, fetch the current labels using the `describe` command, then follow the preceding example for updating labels.
--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:
gcloud infra-manager deployments apply projects/p1/location/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket"
--git-source-directory
=GIT_SOURCE_DIRECTORY
-
Subdirectory inside the repository. Example: 'staging/my-package'
Use in conjunction with
--git-source-repo
and--git-source-ref
Examples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager deployments apply 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-repo
and--git-source-directory
Examples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager deployments apply 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-directory
and--git-source_ref
Examples:
Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:
gcloud infra-manager deployments apply 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" --ignore-file
=IGNORE_FILE
-
Override the
.gcloudignore
file and use the specified file instead. Seegcloud topic gcloudignore
for 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/blueprint
Examples:
Create a deployment from a local storage path
./path/to/blueprint
:gcloud infra-manager deployments apply 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 deployments apply 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 deployments apply 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 help
for details.
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 2024-06-04 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-06-04 UTC."}