This repository contains Terraform code which creates NetAppp 1st-Party Cloud Storage with the corresponding hyperscaler Kubernetes-as-a-Service offering:
- Amazon Elastic Kubernetes Service (EKS) with FSx for NetApp ONTAP
- Azure Kubernetes Service with Azure NetApp Files
- Google Kubernetes Engine (GKE) with Google Cloud NetApp Volumes
The finer details will vary between hyperscaler, however overall each implementation will deploy the following resources:
- Isolated networking (VPC)
- Necessary Identity and Access Management (IAM) policies/roles
- 1st-Party NetApp Storage
- A Kubernetes cluster with:
- Trident CSI installed
- Trident backends configured
- Storage class(es) created and set as default
Simply change into the hyperscaler directory of your choice, and initialize terraform:
terraform init
the provider version in each main.tf file is constrained by the ~> operator to ensure code compatibility, however feel free to change to a different operator if needed.
Next, update the default.tfvars file to have the deployment parameters of choosing. Additional information on their meanings can be found in the variables.tf file.
Plan your deployment with the following command (more information on workspaces in the section below):
terraform plan -var-file="$(terraform workspace show).tfvars"
Create your deployment:
terraform apply -var-file="$(terraform workspace show).tfvars"
When your deployment is no longer needed, run the following command to clean up all resources:
terraform destroy -var-file="$(terraform workspace show).tfvars"
All code in this respository has been designed to support Terraform Workspaces. This enables multiple deployments (for example: prod and dr, and/or useast1 and useast2) of the same type of environments. To create new workspaces (beyond the default workspace), run the following command:
terraform workspace new <workspace-name>
Next, copy the default.tfvars file (be sure to match your workspace name):
cp default.tfvars <workspace-name>.tfvars
Optionally edit the <workspace-name>.tfvars file, and then deploy the new environment with the same command:
terraform apply -var-file="$(terraform workspace show).tfvars"
To switch to a different workspace, run:
terraform workspace select <workspace-name>
To view all available workspaces, run:
terraform workspace list