Skip to content

googleContainerCluster

Get info about a GKE cluster from its name and location.

Example Usage

import * as cdktf from "cdktf";
/*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.*/
const dataGoogleContainerClusterMyCluster =
  new google.dataGoogleContainerCluster.DataGoogleContainerCluster(
    this,
    "my_cluster",
    {
      location: "us-east1-a",
      name: "my-cluster",
    }
  );
new cdktf.TerraformOutput(this, "endpoint", {
  value: dataGoogleContainerClusterMyCluster.endpoint,
});
new cdktf.TerraformOutput(this, "instance_group_urls", {
  value: `\${${dataGoogleContainerClusterMyCluster.nodePool.fqn}[0].instance_group_urls}`,
});
new cdktf.TerraformOutput(this, "node_config", {
  value: dataGoogleContainerClusterMyCluster.nodeConfig,
});
new cdktf.TerraformOutput(this, "node_pools", {
  value: dataGoogleContainerClusterMyCluster.nodePool,
});

Argument Reference

The following arguments are supported:

  • name (Required) - The name of the cluster.

  • location (Optional) - The location (zone or region) this cluster has been created in. One of location, region, zone, or a provider-level zone must be specified.

  • zone (Optional) - The zone this cluster has been created in. Deprecated in favour of location.

  • region (Optional) - The region this cluster has been created in. Deprecated in favour of location.


  • project - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

See google_container_cluster resource for details of the available attributes.