1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 18:45:13 +00:00
gcloud-help/gcloud/infra-manager/deployments/apply
2024-01-10 10:17:49 +00:00

239 lines
9.5 KiB
Text

NAME
gcloud infra-manager deployments apply - create or update a deployment
SYNOPSIS
gcloud infra-manager deployments apply (DEPLOYMENT : --location=LOCATION)
[--artifacts-gcs-bucket=ARTIFACTS_GCS_BUCKET] [--async]
[--import-existing-resources] [--labels=[KEY=VALUE,...]]
[--service-account=SERVICE_ACCOUNT] [--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 storage my-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.
--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.
FLAGS
--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.
--service-account=SERVICE_ACCOUNT
User-specified Service Account (SA) to be used as credential to manage
resources. Format:
projects/{projectID}/serviceAccounts/{serviceAccount}
--worker-pool=WORKER_POOL
User-specified Worker Pool resource in which the Cloud Build jobwill
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.
See gcloud topic gcloudignore for more information.
--local-source=LOCAL_SOURCE
Local storage path where config files are stored. 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.