This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/examples/aws-eks/infrastructure.cue

44 lines
1.3 KiB
CUE
Raw Normal View History

package main
import (
"encoding/json"
"dagger.io/aws"
"dagger.io/aws/cloudformation"
)
#Infrastructure: {
awsConfig: aws.#Config
namePrefix: *"dagger-example-" | string
// Cluster size is 1 for example (to limit resources)
workerNodeCapacity: *1 | >1
workerNodeInstanceType: *"t3.small" | string
let clusterName = "\(namePrefix)eks-cluster"
eksControlPlane: cloudformation.#Stack & {
config: awsConfig
source: json.Marshal(#CFNTemplate.eksControlPlane)
stackName: "\(namePrefix)eks-controlplane"
neverUpdate: true
parameters: ClusterName: clusterName
}
eksNodeGroup: cloudformation.#Stack & {
config: awsConfig
source: json.Marshal(#CFNTemplate.eksNodeGroup)
stackName: "\(namePrefix)eks-nodegroup"
neverUpdate: true
parameters: {
ClusterName: clusterName
ClusterControlPlaneSecurityGroup: eksControlPlane.outputs.DefaultSecurityGroup
NodeAutoScalingGroupDesiredCapacity: 1
NodeAutoScalingGroupMaxSize: NodeAutoScalingGroupDesiredCapacity + 1
NodeGroupName: "\(namePrefix)eks-nodegroup"
NodeInstanceType: workerNodeInstanceType
VpcId: eksControlPlane.outputs.VPC
Subnets: eksControlPlane.outputs.SubnetIds
}
}
}