|
| 1 | +import * as aws from "@pulumi/aws"; |
| 2 | +import * as awsinfra from "@pulumi/aws-infra"; |
| 3 | +import * as pulumi from "@pulumi/pulumi"; |
| 4 | +import * as eks from "@pulumi/eks"; |
| 5 | + |
| 6 | +// Get configuration for the stack |
| 7 | +const config = new pulumi.Config(); |
| 8 | +const instanceType = config.get("instanceType") as aws.ec2.InstanceType; |
| 9 | +const desiredCapacity = config.getNumber("desiredCapacity"); |
| 10 | +const minSize = config.getNumber("minSize"); |
| 11 | +const maxSize = config.getNumber("maxSize"); |
| 12 | +const storageClass = config.get("storageClass") as eks.EBSVolumeType; |
| 13 | +const deployDashboard = config.getBoolean("deployDashboard"); |
| 14 | + |
| 15 | +// Create a VPC for our cluster. |
| 16 | +const network = new awsinfra.Network("eksNetwork"); |
| 17 | + |
| 18 | +// Create an EKS cluster with the given configuration. |
| 19 | +const cluster = new eks.Cluster("cluster", { |
| 20 | + vpcId: network.vpcId, |
| 21 | + subnetIds: network.subnetIds, |
| 22 | + instanceType: instanceType, |
| 23 | + desiredCapacity: desiredCapacity, |
| 24 | + minSize: minSize, |
| 25 | + maxSize: maxSize, |
| 26 | + storageClasses: storageClass, |
| 27 | + deployDashboard: deployDashboard, |
| 28 | +}); |
| 29 | + |
| 30 | +// Export the cluster's kubeconfig. |
| 31 | +export const kubeconfig = cluster.kubeconfig; |
0 commit comments