Creating a Pulumi repository that can spawn an entire EKS cluster involves writing scripts using AWS SDKs and Pulumi's infrastructure as code (IaC) capabilities. Here's a basic guide on how you can do this. Please note that this is a high level overview and you'll need to adjust the code to fit your specific needs:
Install the necessary Pulumi packages for AWS and EKS:
bash
$ npm install @pulumi/eks
Now, you can create a new EKS cluster by writing a Pulumi script. Replace the contents of index.ts in your Pulumi project with the following script:
typescript
import * as pulumi from "@pulumi/pulumi";
import * as eks from "@pulumi/eks";
// Create an EKS cluster with the default configuration.
const cluster = new eks.Cluster("my-cluster");
// Export the clusters' kubeconfig.
export const kubeconfig = cluster.kubeconfig;
Finally, you can deploy the EKS cluster:
bash
$ pulumi up
This will prompt you to confirm the deployment, and then it will provision an EKS cluster, along with all the necessary resources (like VPC and IAM roles), and export the kubeconfig for the cluster.
Remember to configure your AWS credentials in your environment before running pulumi up. You can do this by setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or by using the AWS CLI and running aws configure.
Please note: This will create an EKS cluster with default configurations. You might need to tweak the configurations according to your requirements. For more detailed information, please refer to the official Pulumi EKS documentation (https://www.pulumi.com/docs/intro/cloud-providers/eks/).