googleClientConfig
Use this data source to access the configuration of the Google Cloud provider.
-> Warning: This resource persists a sensitive credential in the remote state used by Terraform. Please take appropriate measures to protect your remote state.
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 dataGoogleClientConfigCurrent =
new google.dataGoogleClientConfig.DataGoogleClientConfig(this, "current", {});
new cdktf.TerraformOutput(this, "project", {
value: dataGoogleClientConfigCurrent.project,
});
Example Usage: Configure Kubernetes provider with OAuth2 access token
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as kubernetes from "./.gen/providers/kubernetes";
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: kubernetes, google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleClientConfigDefault =
new google.dataGoogleClientConfig.DataGoogleClientConfig(this, "default", {});
const dataGoogleContainerClusterMyCluster =
new google.dataGoogleContainerCluster.DataGoogleContainerCluster(
this,
"my_cluster",
{
name: "my-cluster",
zone: "us-east1-a",
}
);
new kubernetes.provider.KubernetesProvider(this, "kubernetes", {
cluster_ca_certificate: `\${base64decode(
${dataGoogleContainerClusterMyCluster.masterAuth.fqn}[0].cluster_ca_certificate,
)}`,
host: `https://\${${dataGoogleContainerClusterMyCluster.endpoint}}`,
token: dataGoogleClientConfigDefault.accessToken,
});
Argument Reference
There are no arguments available for this data source.
Attributes Reference
In addition to the arguments listed above, the following attributes are exported:
-
project
- The ID of the project to apply any resources to. -
region
- The region to operate under. -
zone
- The zone to operate under. -
accessToken
- The OAuth2 access token used by the client to authenticate against the Google Cloud API.