Skip to content

Data Source: awsEksNodeGroups

Retrieve the EKS Node Groups associated with a named EKS cluster. This will allow you to pass a list of Node Group names to other resources.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsEksNodeGroupsExample =
  new aws.dataAwsEksNodeGroups.DataAwsEksNodeGroups(this, "example", {
    clusterName: "example",
  });
const dataAwsEksNodeGroupExample =
  new aws.dataAwsEksNodeGroup.DataAwsEksNodeGroup(this, "example_1", {
    clusterName: "example",
    nodeGroupName: "${each.value}",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsEksNodeGroupExample.overrideLogicalId("example");
/*In most cases loops should be handled in the programming language context and 
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
dataAwsEksNodeGroupExample.addOverride(
  "for_each",
  dataAwsEksNodeGroupsExample.names
);

Argument Reference

  • clusterName - (Required) Name of the cluster.

Attributes Reference

  • id - Cluster name.
  • names - Set of all node group names in an EKS Cluster.