Terraform example of EKS cluster
-
Create an AWS user with key-based access.
-
Assign an IAM policy to the user using the defined in ./aws.policy.json file.
-
Create the
aws.tfvars
file with the following format:access_key = "paste key here" secret_key = "paste key here" region = "eu-central-1"
-
Initialize S3 + Dynamodb backend for storing Terraform state with:
cd init-tf-on-aws terraform init terraform apply -var-file="../aws.tfvars"
-
Initialize and apply the cluster:
cd infra terraform init -backend-config="../aws.tfvars" terraform plan -var-file="../aws.tfvars"
- Remove the
infra
aws resources:cd infra && terraform destroy -var-file="../keys.tfvars"
- Remove the
init-tf-on-aws
aws resources:cd init-tf-on-aws && terraform destroy -var-file="../keys.tfvars"