terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 2.70"
}
}
}
provider "aws" {
region = "us-west-2"
}
resource "aws_eks_cluster" "my_cluster" {
name = "my-eks-cluster"
role_arn = aws_iam_role.eks_cluster.arn
vpc_config {
subnet_ids = ["subnet-abc123", "subnet-def456"] # Replace with your desired subnet IDs
}
}
resource "aws_iam_role" "eks_cluster" {
name = "my-eks-cluster-role"
}
aws eks --region us-west-2 update-kubeconfig --name my-eks-cluster
terraform init
terraform apply
Would you like a cup of coffee?