Skip to content

googleClouddeployTarget

The Cloud Deploy target resource

Example Usage - multi_target

tests creating and updating a multi-target

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.clouddeployTarget.ClouddeployTarget(this, "primary", {
  annotations: [
    {
      my_first_annotation: "example-annotation-1",
      my_second_annotation: "example-annotation-2",
    },
  ],
  description: "multi-target description",
  execution_configs: [
    {
      execution_timeout: "3600s",
      usages: ["RENDER", "DEPLOY"],
    },
  ],
  labels: [
    {
      my_first_label: "example-label-1",
      my_second_label: "example-label-2",
    },
  ],
  location: "us-west1",
  multi_target: [
    {
      target_ids: ["1", "2"],
    },
  ],
  name: "target",
  project: "my-project-name",
  provider: "${google-beta}",
  require_approval: false,
});

Example Usage - run_target

tests creating and updating a cloud run target

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.clouddeployTarget.ClouddeployTarget(this, "primary", {
  annotations: [
    {
      my_first_annotation: "example-annotation-1",
      my_second_annotation: "example-annotation-2",
    },
  ],
  description: "basic description",
  execution_configs: [
    {
      execution_timeout: "3600s",
      usages: ["RENDER", "DEPLOY"],
    },
  ],
  labels: [
    {
      my_first_label: "example-label-1",
      my_second_label: "example-label-2",
    },
  ],
  location: "us-west1",
  name: "target",
  project: "my-project-name",
  provider: "${google-beta}",
  require_approval: false,
  run: [
    {
      location: "projects/my-project-name/locations/us-west1",
    },
  ],
});

Example Usage - target

Creates a basic Cloud Deploy target

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.clouddeployTarget.ClouddeployTarget(this, "primary", {
  annotations: [
    {
      my_first_annotation: "example-annotation-1",
      my_second_annotation: "example-annotation-2",
    },
  ],
  description: "basic description",
  gke: [
    {
      cluster:
        "projects/my-project-name/locations/us-west1/clusters/example-cluster-name",
    },
  ],
  labels: [
    {
      my_first_label: "example-label-1",
      my_second_label: "example-label-2",
    },
  ],
  location: "us-west1",
  name: "target",
  project: "my-project-name",
  require_approval: false,
});

Argument Reference

The following arguments are supported:

  • location - (Required) The location for the resource

  • name - (Required) Name of the target. Format is [a-z][a-z0-9-]{0,62}.


  • annotations - (Optional) Optional. User annotations. These attributes can only be set and used by the user, and not by Google Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.

  • anthosCluster - (Optional) Information specifying an Anthos Cluster.

  • description - (Optional) Optional. Description of the target. Max length is 255 characters.

  • executionConfigs - (Optional) Configurations for all execution that relates to this target. Each executionEnvironmentUsage value may only be used in a single configuration; using the same value multiple times is an error. When one or more configurations are specified, they must include the render and deploy executionEnvironmentUsage values. When no configurations are specified, execution will use the default specified in defaultPool.

  • gke - (Optional) Information specifying a GKE Cluster.

  • labels - (Optional) Optional. Labels are attributes that can be set and used by both the user and by Google Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.

  • multiTarget - (Optional) (Beta only) Information specifying a multiTarget.

  • project - (Optional) The project for the resource

  • requireApproval - (Optional) Optional. Whether or not the target requires approval.

  • run - (Optional) (Beta only) Information specifying a Cloud Run deployment target.

The anthosCluster block supports:

  • membership - (Optional) Membership of the GKE Hub-registered cluster to which to apply the Skaffold configuration. Format is projects/{project}/locations/{location}/memberships/{membershipName}.

The executionConfigs block supports:

  • artifactStorage - (Optional) Optional. Cloud Storage location in which to store execution outputs. This can either be a bucket ("gs://my-bucket") or a path within a bucket ("gs://my-bucket/my-dir"). If unspecified, a default bucket located in the same region will be used.

  • executionTimeout - (Optional) Optional. Execution timeout for a Cloud Build Execution. This must be between 10m and 24h in seconds format. If unspecified, a default timeout of 1h is used.

  • serviceAccount - (Optional) Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) is used.

  • usages - (Required) Required. Usages when this configuration should be applied.

  • workerPool - (Optional) Optional. The resource name of the workerPool, with the format projects/{project}/locations/{location}/workerPools/{workerPool}. If this optional field is unspecified, the default Cloud Build pool will be used.

The gke block supports:

  • cluster - (Optional) Information specifying a GKE Cluster. Format is `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}.

  • internalIp - (Optional) Optional. If true, cluster is accessed using the private IP address of the control plane endpoint. Otherwise, the default IP address of the control plane endpoint is used. The default IP address is the private IP address for clusters with private control-plane endpoints and the public IP address otherwise. Only specify this option when cluster is a private GKE cluster.

The multiTarget block supports:

  • targetIds - (Required) Required. The target_ids of this multiTarget.

The run block supports:

  • location - (Required) Required. The location where the Cloud Run Service should be located. Format is projects/{project}/locations/{location}.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{location}}/targets/{{name}}

  • createTime - Output only. Time at which the target was created.

  • etag - Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.

  • targetId - Output only. Resource id of the target.

  • uid - Output only. Unique identifier of the target.

  • updateTime - Output only. Most recent time at which the target was updated.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Target can be imported using any of these accepted formats:

$ terraform import google_clouddeploy_target.default projects/{{project}}/locations/{{location}}/targets/{{name}}
$ terraform import google_clouddeploy_target.default {{project}}/{{location}}/{{name}}
$ terraform import google_clouddeploy_target.default {{location}}/{{name}}