AWS Terraform Conventions
Purpose
Apply these rules to all AWS foundation Terraform generated for KAS/NVCF EKS.
This skill owns conventions only; use component skills for resource-specific
content.
Terraform Ownership
Terraform owns these resources:
- VPC and subnets
- Internet gateway, NAT gateway, route tables, and subnet route associations
- EKS cluster and OIDC provider
- EKS managed node groups:
system, compute, and gpu
- IAM roles and policies for the cluster and node groups
- ECR repositories under a stable cluster prefix, for example
${CLUSTER_NAME}/...
- Security groups needed for EKS-managed infrastructure only
- Terraform outputs needed by later skills
Terraform must not own:
- Kubernetes in-cluster objects such as namespaces, services, service accounts,
RBAC, ConfigMaps, or storage classes
- Helm releases or Helmfile environments
- NVCF control plane, NVCA, LLS, caches, UCC, DDCS, storage APIs, functions, or
stream validation
- NGC to ECR image copy jobs
- Secret values or registry auth artifacts
- GPU Operator Helm release state
Project Rules
- Keep image mirroring separate from infra. Infra may create ECR repositories,
but it must not copy NGC images as part of
terraform apply.
- Do not hardcode image versions in Terraform.
- Do not create login material or machine access material with Terraform.
- Do not use
null_resource or local-exec for mirror jobs, waiters, or
imperative Kubernetes work.
- Use AWS-managed EKS behavior where possible. App ingress belongs to
Kubernetes controllers/services after infra.
- Use explicit per-environment CIDRs. Do not auto-select CIDRs unless the repo
already has a reviewed helper for that.
- Keep state safe. Prefer a remote backend for shared work; if local state is
used, never run concurrent applies against the same env.
- Add consistent tags to all taggable resources:
Name, cluster, owner,
environment, managed-by=terraform, and workload=kas.
- Use the EKS GPU-optimized AMI for the GPU managed node group:
ami_type = "AL2023_x86_64_NVIDIA".
- Label GPU nodes with
nvidia.com/gpu.deploy.driver=false; GPU Operator
must not install the driver or container toolkit.
- Keep Helm releases outside Terraform state.
- Do not store secrets in
*.tf, *.tfvars, generated scripts, or Terraform
state when avoidable.
Expected Layout
Use a root stack per environment. A simple validation layout is acceptable:
terraform/aws/envs/<cluster>/
├── main.tf
├── providers.tf
├── variables.tf
├── outputs.tf
└── terraform.tfvars
When generating review artifacts, prefix the same layout with generated/:
generated/terraform/aws/envs/<cluster>/
For promoted code, split into modules only when it removes real complexity:
terraform/aws/modules/network
terraform/aws/modules/eks
terraform/aws/modules/ecr
Provider And Backend
Require explicit region input:
variable "aws_region" {
type = string
}
provider "aws" {
region = var.aws_region
}
Prefer a remote backend for shared environments. If using local state for a
single-user validation environment, call that out in the generated README or
run instructions and do not run concurrent applies.
Pre-Apply Checklist
1---2name: aws-tf-conventions3description: Project-specific Terraform rules for the AWS KAS/NVCF EKS foundation. Use when writing or reviewing AWS Terraform for VPC, EKS, node groups, IAM, ECR, state, tags, provider configuration, or before terraform apply.4---56<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->7<!-- SPDX-License-Identifier: CC-BY-4.0 AND Apache-2.0 -->89# AWS Terraform Conventions1011## Purpose1213Apply these rules to all AWS foundation Terraform generated for KAS/NVCF EKS.14This skill owns conventions only; use component skills for resource-specific15content.1617## Terraform Ownership1819Terraform owns these resources:2021- VPC and subnets22- Internet gateway, NAT gateway, route tables, and subnet route associations23- EKS cluster and OIDC provider24- EKS managed node groups: `system`, `compute`, and `gpu`25- IAM roles and policies for the cluster and node groups26- ECR repositories under a stable cluster prefix, for example `${CLUSTER_NAME}/...`27- Security groups needed for EKS-managed infrastructure only28- Terraform outputs needed by later skills2930Terraform must not own:3132- Kubernetes in-cluster objects such as namespaces, services, service accounts,33 RBAC, ConfigMaps, or storage classes34- Helm releases or Helmfile environments35- NVCF control plane, NVCA, LLS, caches, UCC, DDCS, storage APIs, functions, or36 stream validation37- NGC to ECR image copy jobs38- Secret values or registry auth artifacts39- GPU Operator Helm release state4041## Project Rules42431. Keep image mirroring separate from infra. Infra may create ECR repositories,44 but it must not copy NGC images as part of `terraform apply`.452. Do not hardcode image versions in Terraform.463. Do not create login material or machine access material with Terraform.474. Do not use `null_resource` or `local-exec` for mirror jobs, waiters, or48 imperative Kubernetes work.495. Use AWS-managed EKS behavior where possible. App ingress belongs to50 Kubernetes controllers/services after infra.516. Use explicit per-environment CIDRs. Do not auto-select CIDRs unless the repo52 already has a reviewed helper for that.537. Keep state safe. Prefer a remote backend for shared work; if local state is54 used, never run concurrent applies against the same env.558. Add consistent tags to all taggable resources: `Name`, `cluster`, `owner`,56 `environment`, `managed-by=terraform`, and `workload=kas`.579. Use the EKS GPU-optimized AMI for the GPU managed node group:58 `ami_type = "AL2023_x86_64_NVIDIA"`.5910. Label GPU nodes with `nvidia.com/gpu.deploy.driver=false`; GPU Operator60 must not install the driver or container toolkit.6111. Keep Helm releases outside Terraform state.6212. Do not store secrets in `*.tf`, `*.tfvars`, generated scripts, or Terraform63 state when avoidable.6465## Expected Layout6667Use a root stack per environment. A simple validation layout is acceptable:6869```text70terraform/aws/envs/<cluster>/71├── main.tf72├── providers.tf73├── variables.tf74├── outputs.tf75└── terraform.tfvars76```7778When generating review artifacts, prefix the same layout with `generated/`:7980```text81generated/terraform/aws/envs/<cluster>/82```8384For promoted code, split into modules only when it removes real complexity:8586```text87terraform/aws/modules/network88terraform/aws/modules/eks89terraform/aws/modules/ecr90```9192## Provider And Backend9394Require explicit region input:9596```hcl97variable "aws_region" {98 type = string99}100101provider "aws" {102 region = var.aws_region103}104```105106Prefer a remote backend for shared environments. If using local state for a107single-user validation environment, call that out in the generated README or108run instructions and do not run concurrent applies.109110## Pre-Apply Checklist111112- [ ] `terraform fmt -recursive` has run.113- [ ] `terraform validate` passes.114- [ ] `terraform plan` contains only expected AWS foundation resources.115- [ ] No plan action destroys or replaces a resource without explicit review.116- [ ] Tags are present on all taggable resources.117- [ ] No secrets or kubeconfig contents appear in Terraform files or outputs.118- [ ] GPU Operator, NVCF, and image mirroring are outside Terraform.