Skip to content

Data Source: awsEksClusterAuth

Get an authentication token to communicate with an EKS cluster.

Uses IAM credentials from the AWS provider to generate a temporary token that is compatible with AWS IAM Authenticator authentication. This can be used to authenticate to an EKS cluster or to a cluster that has the AWS IAM Authenticator server configured.

\~> NOTE: Dynamically configuring a Terraform Provider via data sources currently has implications on resource import support.

Example Usage

/*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 aws from "./.gen/providers/aws";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: kubernetes.
For a more precise conversion please use the --provider flag in convert.*/
const dataAwsEksClusterExample = new aws.dataAwsEksCluster.DataAwsEksCluster(
  this,
  "example",
  {
    name: "example",
  }
);
const dataAwsEksClusterAuthExample =
  new aws.dataAwsEksClusterAuth.DataAwsEksClusterAuth(this, "example_1", {
    name: "example",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsEksClusterAuthExample.overrideLogicalId("example");
new kubernetes.provider.KubernetesProvider(this, "kubernetes", {
  cluster_ca_certificate: `\${base64decode(${dataAwsEksClusterExample.certificateAuthority.fqn}[0].data)}`,
  host: dataAwsEksClusterExample.endpoint,
  token: dataAwsEksClusterAuthExample.token,
});

Argument Reference

  • name - (Required) Name of the cluster

Attributes Reference

  • id - Name of the cluster.
  • token - Token to use to authenticate with the cluster.