├── modules ├── vpc │ ├── versions.tf │ ├── variable.tf │ ├── vpc.tf │ ├── outputs.tf │ └── README.md ├── eks-rbac-default-roles │ ├── versions.tf │ ├── rbac-default-roles-creation.tf │ ├── rbac-role-read-only.yaml │ ├── rbac-role-dev.yaml │ └── README.md ├── eks-external-secrets │ ├── outputs.tf │ ├── versions.tf │ ├── external-secrets.tf │ ├── es-parameter-store-secret-store.tf │ ├── variables.tf │ ├── es-parameter-store.tf │ └── README.md ├── eks │ ├── outputs.tf │ ├── versions.tf │ ├── variable.tf │ ├── eks.tf │ ├── karpenter.tf │ ├── eks-outputs.tf │ └── README.md ├── eks-ebs-csi-driver │ ├── versions.tf │ ├── variables.tf │ ├── ebs-csi-driver-helm.tf │ ├── iam.tf │ └── README.md └── eks-load-balancer-controller │ ├── versions.tf │ ├── outputs.tf │ ├── loadbalancer-controller-helm.tf │ ├── variables.tf │ ├── iam.tf │ └── README.md ├── docs ├── eks-karpenter │ └── README.md ├── index.md ├── eks-rbac-default-roles │ └── README.md ├── terraform-state-management │ └── README.md ├── eks-ebs-csi-driver │ └── README.md ├── eks-load-balancer-controller │ └── README.md ├── eks-external-secrets │ └── README.md ├── eks │ └── README.md └── vpc │ └── README.md ├── versions.tf ├── outputs.tf ├── terraform.tfvars.example ├── mkdocs.yml ├── tf-backend.tf ├── .terraform-docs.yml ├── .gitignore ├── tf-backend-outputs.tf ├── generate-docs.sh ├── main.tf ├── provider.tf ├── variables.tf ├── README.md └── LICENSE /modules/vpc/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /modules/eks-rbac-default-roles/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | kubectl = { 6 | source = "gavinbunney/kubectl" 7 | version = ">= 1.14" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/outputs.tf: -------------------------------------------------------------------------------- 1 | output "helm_external_secrets_version" { 2 | value = helm_release.external_secrets.version 3 | } 4 | 5 | output "helm_external_secrets_namespace" { 6 | value = helm_release.external_secrets.namespace 7 | } 8 | -------------------------------------------------------------------------------- /modules/eks/outputs.tf: -------------------------------------------------------------------------------- 1 | output "karpenter-irsa-arn" { 2 | value = module.karpenter.irsa_arn 3 | } 4 | 5 | output "helm_karpenter_version" { 6 | value = helm_release.karpenter.version 7 | } 8 | 9 | output "helm_karpenter_namespace" { 10 | value = helm_release.karpenter.namespace 11 | } 12 | -------------------------------------------------------------------------------- /docs/eks-karpenter/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | No requirements. 4 | 5 | ## Providers 6 | 7 | No providers. 8 | 9 | ## Modules 10 | 11 | No modules. 12 | 13 | ## Resources 14 | 15 | No resources. 16 | 17 | ## Inputs 18 | 19 | No inputs. 20 | 21 | ## Outputs 22 | 23 | No outputs. 24 | -------------------------------------------------------------------------------- /modules/eks-rbac-default-roles/rbac-default-roles-creation.tf: -------------------------------------------------------------------------------- 1 | resource "kubectl_manifest" "rbac_role_read_only" { 2 | for_each = toset(split("---", file("${path.module}/rbac-role-read-only.yaml"))) 3 | yaml_body = each.key 4 | } 5 | 6 | resource "kubectl_manifest" "rbac_role_dev" { 7 | for_each = toset(split("---", file("${path.module}/rbac-role-dev.yaml"))) 8 | yaml_body = each.key 9 | } 10 | -------------------------------------------------------------------------------- /modules/eks-ebs-csi-driver/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | helm = { 10 | source = "hashicorp/helm" 11 | version = ">= 2.11" 12 | } 13 | http = { 14 | source = "hashicorp/http" 15 | version = ">= 3.4" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | helm = { 10 | source = "hashicorp/helm" 11 | version = ">= 2.11" 12 | } 13 | kubectl = { 14 | source = "gavinbunney/kubectl" 15 | version = ">= 1.14" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | helm = { 10 | source = "hashicorp/helm" 11 | version = ">= 2.11" 12 | } 13 | http = { 14 | source = "hashicorp/http" 15 | version = ">= 3.4" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/outputs.tf: -------------------------------------------------------------------------------- 1 | output "lb-controller-role" { 2 | description = "Role to Load Balancer Controller use to create and configure the load balancers" 3 | value = aws_iam_role.kubernetes_alb_controller.arn 4 | } 5 | 6 | output "helm_loadbalancer_controller_version" { 7 | value = helm_release.alb_controller.version 8 | } 9 | 10 | output "helm_loadbalancer_controller_namespace" { 11 | value = helm_release.alb_controller.namespace 12 | } 13 | 14 | -------------------------------------------------------------------------------- /versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | helm = { 10 | source = "hashicorp/helm" 11 | version = ">= 2.11" 12 | } 13 | kubernetes = { 14 | source = "hashicorp/kubernetes" 15 | version = ">= 2.23" 16 | } 17 | kubectl = { 18 | source = "gavinbunney/kubectl" 19 | version = ">= 1.14" 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/external-secrets.tf: -------------------------------------------------------------------------------- 1 | resource "helm_release" "external_secrets" { 2 | name = "external-secrets" 3 | chart = "external-secrets" 4 | repository = "https://charts.external-secrets.io" 5 | version = var.helm_chart_version 6 | namespace = var.namespace 7 | create_namespace = true 8 | 9 | set { 10 | name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn" 11 | value = aws_iam_role.external_secrets.arn 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /modules/eks/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = ">= 1.0" 3 | 4 | required_providers { 5 | aws = { 6 | source = "hashicorp/aws" 7 | version = ">= 5.20" 8 | } 9 | helm = { 10 | source = "hashicorp/helm" 11 | version = ">= 2.11" 12 | } 13 | kubernetes = { 14 | source = "hashicorp/kubernetes" 15 | version = ">= 2.23" 16 | } 17 | kubectl = { 18 | source = "gavinbunney/kubectl" 19 | version = ">= 1.14" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /modules/eks-rbac-default-roles/rbac-role-read-only.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: read-only-role 5 | rules: 6 | - apiGroups: ["*"] 7 | resources: ["*"] 8 | verbs: ["get", "list", "watch"] 9 | --- 10 | apiVersion: rbac.authorization.k8s.io/v1 11 | kind: ClusterRoleBinding 12 | metadata: 13 | name: read-only-binding 14 | subjects: 15 | - kind: User 16 | name: read-only-user 17 | apiGroup: rbac.authorization.k8s.io 18 | roleRef: 19 | kind: ClusterRole 20 | name: read-only-role 21 | apiGroup: rbac.authorization.k8s.io 22 | -------------------------------------------------------------------------------- /outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_outputs" { 2 | value = var.all_outputs ? module.vpc : null 3 | } 4 | 5 | output "eks_outputs" { 6 | value = var.all_outputs ? module.eks : null 7 | } 8 | 9 | output "eks_loadbalancer_outputs" { 10 | value = var.all_outputs ? module.eks_loadbalancer : null 11 | } 12 | 13 | output "configure_kubectl" { 14 | description = "Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig" 15 | value = "aws eks --region ${local.region} update-kubeconfig --name ${module.eks.cluster_name}" 16 | } 17 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Terraform Modules Documentation 2 | 3 | ## Modules 4 | 5 | - [eks](./eks/README.md) 6 | - [eks-ebs-csi-driver](./eks-ebs-csi-driver/README.md) 7 | - [eks-external-secrets](./eks-external-secrets/README.md) 8 | - [eks-karpenter](./eks-karpenter/README.md) 9 | - [eks-kube-prometheus-stack](./eks-kube-prometheus-stack/README.md) 10 | - [eks-load-balancer-controller](./eks-load-balancer-controller/README.md) 11 | - [eks-rbac-default-roles](./eks-rbac-default-roles/README.md) 12 | - [eks-velero](./eks-velero/README.md) 13 | - [terraform-state-management](./terraform-state-management/README.md) 14 | - [vpc](./vpc/README.md) 15 | -------------------------------------------------------------------------------- /terraform.tfvars.example: -------------------------------------------------------------------------------- 1 | aws_region = "us-east-1" 2 | 3 | # VPC 4 | cidr = "10.0.0.0/16" 5 | qtt_az = 3 6 | create_subnet_public = true 7 | create_subnet_private = true 8 | create_nat_gateway = true 9 | one_nat_gateway_per_az = false 10 | create_subnet_data = true 11 | 12 | # EKS 13 | cluster_endpoint_public_access = true #only for tests, it must be private with VPN 14 | kubernetes_version = "1.27" 15 | 16 | # eks_admin_principal_arn = "arn:aws:iam::123456789012:role/my-role-to-eks-admin" 17 | 18 | 19 | create_state_storage = true # tf-backend state storage and lock 20 | all_outputs = false 21 | es_secret_store_namespace = ["dev"] 22 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Terraform Modules Documentation 2 | 3 | docs_dir: docs 4 | 5 | theme: 6 | name: readthedocs 7 | 8 | nav: 9 | - Home: index.md 10 | - eks: eks/README.md 11 | - eks-ebs-csi-driver: eks-ebs-csi-driver/README.md 12 | - eks-external-secrets: eks-external-secrets/README.md 13 | - eks-karpenter: eks-karpenter/README.md 14 | - eks-kube-prometheus-stack: eks-kube-prometheus-stack/README.md 15 | - eks-load-balancer-controller: eks-load-balancer-controller/README.md 16 | - eks-rbac-default-roles: eks-rbac-default-roles/README.md 17 | - eks-velero: eks-velero/README.md 18 | - terraform-state-management: terraform-state-management/README.md 19 | - vpc: vpc/README.md 20 | 21 | -------------------------------------------------------------------------------- /tf-backend.tf: -------------------------------------------------------------------------------- 1 | # You cannot create a new backend by simply defining this and then 2 | # immediately proceeding to "terraform apply". The S3 backend must 3 | # be bootstrapped according to the simple yet essential procedure in 4 | # https://github.com/cloudposse/terraform-aws-tfstate-backend#usage 5 | module "terraform_state_backend" { 6 | source = "cloudposse/tfstate-backend/aws" 7 | 8 | count = var.create_state_storage ? 1 : 0 9 | 10 | version = "1.1.1" 11 | namespace = "apolinario" 12 | stage = "test" 13 | name = "terraform" 14 | attributes = ["state"] 15 | 16 | terraform_backend_config_file_path = "." 17 | terraform_backend_config_file_name = "backend.tf" 18 | force_destroy = false 19 | } 20 | 21 | -------------------------------------------------------------------------------- /.terraform-docs.yml: -------------------------------------------------------------------------------- 1 | formatter: "" # this is required 2 | 3 | version: "" 4 | 5 | header-from: main.tf 6 | footer-from: "" 7 | 8 | recursive: 9 | enabled: false 10 | path: modules 11 | 12 | sections: 13 | hide: [] 14 | show: [] 15 | 16 | content: "" 17 | 18 | output: 19 | file: "" 20 | mode: inject 21 | template: |- 22 | 23 | {{ .Content }} 24 | 25 | 26 | output-values: 27 | enabled: false 28 | from: "" 29 | 30 | sort: 31 | enabled: true 32 | by: name 33 | 34 | settings: 35 | anchor: true 36 | color: true 37 | default: true 38 | description: false 39 | escape: true 40 | hide-empty: false 41 | html: true 42 | indent: 2 43 | lockfile: true 44 | read-comments: true 45 | required: true 46 | sensitive: true 47 | type: true 48 | -------------------------------------------------------------------------------- /modules/eks-ebs-csi-driver/variables.tf: -------------------------------------------------------------------------------- 1 | variable "cluster_name" { 2 | type = string 3 | description = "The name of the cluster" 4 | } 5 | 6 | variable "cluster_identity_oidc_provider" { 7 | type = string 8 | description = "The OIDC Identity provider for the cluster." 9 | } 10 | 11 | variable "helm_chart_version" { 12 | type = string 13 | default = "v1.23.1" 14 | description = "EBS CSI Driver Helm chart version." 15 | } 16 | 17 | variable "namespace" { 18 | type = string 19 | default = "kube-system" 20 | description = "Kubernetes namespace to deploy the EBS CSI Driver Helm chart." 21 | } 22 | 23 | variable "service_account_name" { 24 | type = string 25 | default = "ebs-csi-controller-sa" 26 | description = "EBS CSI Driver Service Account Name" 27 | } 28 | -------------------------------------------------------------------------------- /modules/eks-rbac-default-roles/rbac-role-dev.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: dev-role 5 | rules: 6 | - apiGroups: ["*"] 7 | resources: ["pods", "jobs"] 8 | verbs: ["get", "list", "watch", "scale", "delete", "patch"] 9 | - apiGroups: ["batch"] 10 | resources: ["jobs"] 11 | verbs: ["create", "get", "list", "watch", "patch"] 12 | - apiGroups: ["batch"] 13 | resources: ["cronjobs"] 14 | verbs: ["create", "get", "list", "watch", "patch"] 15 | --- 16 | apiVersion: rbac.authorization.k8s.io/v1 17 | kind: ClusterRoleBinding 18 | metadata: 19 | name: dev-binding 20 | subjects: 21 | - kind: User 22 | name: dev-user 23 | apiGroup: rbac.authorization.k8s.io 24 | roleRef: 25 | kind: ClusterRole 26 | name: dev-role 27 | apiGroup: rbac.authorization.k8s.io 28 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/es-parameter-store-secret-store.tf: -------------------------------------------------------------------------------- 1 | resource "kubectl_manifest" "es_parameter_store_secret_store_deployment" { 2 | depends_on = [ 3 | aws_iam_role_policy_attachment.external_secrets, 4 | kubernetes_service_account.es_parameter_store_sa, 5 | helm_release.external_secrets 6 | ] 7 | 8 | for_each = toset(var.secret_store_namespace) 9 | 10 | yaml_body = <<-YAML 11 | apiVersion: external-secrets.io/v1beta1 12 | kind: SecretStore 13 | metadata: 14 | name: aws-parameterstore 15 | namespace: ${each.key} 16 | spec: 17 | # controller: parameter-store 18 | provider: 19 | aws: 20 | service: ParameterStore 21 | region: ${var.aws_region} 22 | auth: 23 | jwt: 24 | serviceAccountRef: 25 | name: ${var.service_account_name} 26 | YAML 27 | } 28 | -------------------------------------------------------------------------------- /modules/eks-ebs-csi-driver/ebs-csi-driver-helm.tf: -------------------------------------------------------------------------------- 1 | # #https://github.com/kubernetes-sigs/aws-ebs-csi-driver/ 2 | 3 | resource "helm_release" "aws_ebs_csi_driver" { 4 | depends_on = [module.ebs_csi_controller_role] 5 | name = "aws-ebs-csi-driver" 6 | chart = "aws-ebs-csi-driver" 7 | repository = "https://kubernetes-sigs.github.io/aws-ebs-csi-driver" 8 | version = var.helm_chart_version 9 | namespace = var.namespace 10 | create_namespace = true 11 | 12 | set { 13 | name = "controller.serviceAccount.create" 14 | value = "true" 15 | } 16 | 17 | set { 18 | name = "controller.serviceAccount.name" 19 | value = var.service_account_name 20 | } 21 | 22 | set { 23 | name = "controller.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn" 24 | value = module.ebs_csi_controller_role.iam_role_arn 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /modules/eks/variable.tf: -------------------------------------------------------------------------------- 1 | variable "tfname" { 2 | description = "Tf Name. local.name value" 3 | type = string 4 | } 5 | 6 | variable "azs" { 7 | description = "The list of AZ to use" 8 | type = list(any) 9 | } 10 | 11 | variable "vpc_id" { 12 | description = "VPC ID" 13 | type = string 14 | } 15 | 16 | variable "private_subnets" { 17 | description = "List of private Subnets" 18 | type = list(string) 19 | } 20 | 21 | variable "kubernetes_version" { 22 | description = "Kubernetes Version" 23 | type = string 24 | } 25 | 26 | variable "cluster_endpoint_public_access" { 27 | description = "(Optional) Cluster Endpoint with public access" 28 | type = bool 29 | default = false 30 | } 31 | 32 | variable "karpenter_helm_chart_version" { 33 | type = string 34 | default = "v0.31.1" 35 | description = "Karpenter Helm chart version." 36 | } 37 | -------------------------------------------------------------------------------- /docs/eks-rbac-default-roles/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 7 | 8 | ## Providers 9 | 10 | | Name | Version | 11 | |------|---------| 12 | | [kubectl](#provider\_kubectl) | >= 1.14 | 13 | 14 | ## Modules 15 | 16 | No modules. 17 | 18 | ## Resources 19 | 20 | | Name | Type | 21 | |------|------| 22 | | [kubectl_manifest.rbac_role_dev](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 23 | | [kubectl_manifest.rbac_role_read_only](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 24 | 25 | ## Inputs 26 | 27 | No inputs. 28 | 29 | ## Outputs 30 | 31 | No outputs. 32 | -------------------------------------------------------------------------------- /modules/eks-rbac-default-roles/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 7 | 8 | ## Providers 9 | 10 | | Name | Version | 11 | |------|---------| 12 | | [kubectl](#provider\_kubectl) | >= 1.14 | 13 | 14 | ## Modules 15 | 16 | No modules. 17 | 18 | ## Resources 19 | 20 | | Name | Type | 21 | |------|------| 22 | | [kubectl_manifest.rbac_role_dev](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 23 | | [kubectl_manifest.rbac_role_read_only](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 24 | 25 | ## Inputs 26 | 27 | No inputs. 28 | 29 | ## Outputs 30 | 31 | No outputs. 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Terraform.gitignore 2 | # Local .terraform directories 3 | **/.terraform/* 4 | 5 | # .tfstate files 6 | *.tfstate 7 | *.tfstate.* 8 | 9 | # Crash log files 10 | crash.log 11 | crash.*.log 12 | 13 | # Exclude all .tfvars files, which are likely to contain sensitive data, such as 14 | # password, private keys, and other secrets. These should not be part of version 15 | # control as they are data points which are potentially sensitive and subject 16 | # to change depending on the environment. 17 | *.tfvars 18 | *.tfvars.json 19 | 20 | # Ignore override files as they are usually used to override resources locally and so 21 | # are not checked in 22 | override.tf 23 | override.tf.json 24 | *_override.tf 25 | *_override.tf.json 26 | 27 | # Include override files you do wish to add to version control using negated pattern 28 | # !example_override.tf 29 | 30 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan 31 | # example: *tfplan* 32 | 33 | # Ignore CLI configuration files 34 | .terraformrc 35 | terraform.rc 36 | 37 | .terraform.lock.hcl 38 | backend.tf 39 | **/downloaded-* 40 | -------------------------------------------------------------------------------- /tf-backend-outputs.tf: -------------------------------------------------------------------------------- 1 | output "s3_bucket_domain_name" { 2 | value = module.terraform_state_backend.*.s3_bucket_domain_name 3 | description = "S3 bucket domain name" 4 | } 5 | 6 | output "s3_bucket_id" { 7 | value = module.terraform_state_backend.*.s3_bucket_id 8 | description = "S3 bucket ID" 9 | } 10 | 11 | output "s3_bucket_arn" { 12 | value = module.terraform_state_backend.*.s3_bucket_arn 13 | description = "S3 bucket ARN" 14 | } 15 | 16 | output "s3_replication_role_arn" { 17 | value = module.terraform_state_backend.*.s3_replication_role_arn 18 | description = "The ARN of the IAM Role created for replication, if enabled." 19 | } 20 | 21 | output "dynamodb_table_name" { 22 | value = module.terraform_state_backend.*.dynamodb_table_name 23 | description = "DynamoDB table name" 24 | } 25 | 26 | output "dynamodb_table_id" { 27 | value = module.terraform_state_backend.*.dynamodb_table_id 28 | description = "DynamoDB table ID" 29 | } 30 | 31 | output "dynamodb_table_arn" { 32 | value = module.terraform_state_backend.*.dynamodb_table_arn 33 | description = "DynamoDB table ARN" 34 | } 35 | 36 | output "terraform_backend_config" { 37 | value = module.terraform_state_backend.*.terraform_backend_config 38 | description = "Rendered Terraform backend config file" 39 | 40 | } 41 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/loadbalancer-controller-helm.tf: -------------------------------------------------------------------------------- 1 | #https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases 2 | #https://github.com/aws/eks-charts/tree/master/stable/aws-load-balancer-controller 3 | #https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html 4 | 5 | resource "helm_release" "alb_controller" { 6 | name = "aws-load-balancer-controller" 7 | chart = "aws-load-balancer-controller" 8 | repository = "https://aws.github.io/eks-charts" 9 | version = var.helm_chart_version 10 | namespace = var.namespace 11 | create_namespace = true 12 | 13 | set { 14 | name = "clusterName" 15 | value = var.cluster_name 16 | } 17 | 18 | set { 19 | name = "awsRegion" 20 | value = var.aws_region 21 | } 22 | 23 | set { 24 | name = "rbac.create" 25 | value = "true" 26 | } 27 | 28 | set { 29 | name = "serviceAccount.create" 30 | value = "true" 31 | } 32 | 33 | set { 34 | name = "serviceAccount.name" 35 | value = var.service_account_name 36 | } 37 | 38 | set { 39 | name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn" 40 | value = aws_iam_role.kubernetes_alb_controller.arn 41 | } 42 | 43 | set { 44 | name = "enableServiceMutatorWebhook" 45 | value = "false" 46 | } 47 | 48 | values = [ 49 | yamlencode(var.settings) 50 | ] 51 | 52 | } 53 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/variables.tf: -------------------------------------------------------------------------------- 1 | variable "cluster_name" { 2 | type = string 3 | description = "The name of the cluster" 4 | } 5 | 6 | variable "aws_region" { 7 | type = string 8 | description = "AWS region where secrets are stored." 9 | } 10 | 11 | variable "cluster_identity_oidc_issuer" { 12 | type = string 13 | description = "The OIDC Identity issuer for the cluster." 14 | } 15 | 16 | variable "cluster_identity_oidc_issuer_arn" { 17 | type = string 18 | description = "The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account." 19 | } 20 | 21 | variable "service_account_name" { 22 | type = string 23 | default = "aws-load-balancer-controller" 24 | description = "ALB Controller service account name" 25 | } 26 | 27 | variable "helm_chart_version" { 28 | type = string 29 | default = "1.4.6" 30 | description = "ALB Controller Helm chart version." 31 | } 32 | 33 | variable "aws_lb_controller_version" { 34 | type = string 35 | default = "2.6.1" 36 | description = "ALB Controller Helm chart version." 37 | } 38 | 39 | variable "namespace" { 40 | type = string 41 | default = "lb-controller" 42 | description = "Kubernetes namespace to deploy ALB Controller Helm chart." 43 | } 44 | 45 | variable "settings" { 46 | default = {} 47 | description = "Additional settings which will be passed to the Helm chart values." 48 | } 49 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/variables.tf: -------------------------------------------------------------------------------- 1 | variable "cluster_name" { 2 | type = string 3 | description = "The name of the cluster" 4 | } 5 | 6 | variable "aws_region" { 7 | type = string 8 | description = "AWS region where secrets are stored." 9 | } 10 | 11 | variable "cluster_identity_oidc_issuer" { 12 | type = string 13 | description = "The OIDC Identity issuer for the cluster." 14 | } 15 | 16 | variable "cluster_identity_oidc_issuer_arn" { 17 | type = string 18 | description = "The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account." 19 | } 20 | 21 | variable "service_account_name" { 22 | type = string 23 | default = "external-secret-sa" 24 | description = "External Secret service account name" 25 | } 26 | 27 | variable "helm_chart_version" { 28 | type = string 29 | default = "0.9.5" 30 | description = "External Secrets Helm chart version." 31 | } 32 | 33 | variable "namespace" { 34 | type = string 35 | default = "external-secrets" 36 | description = "Kubernetes namespace to deploy External Secrets Helm chart." 37 | } 38 | 39 | variable "parameter_store_prefix" { 40 | type = string 41 | default = "" 42 | description = "(Optional) Prefix of parameter store to allowed access" 43 | } 44 | 45 | variable "secret_store_namespace" { 46 | type = list(string) 47 | description = "Namespaces to create the external secrets secret store" 48 | } 49 | -------------------------------------------------------------------------------- /modules/eks-ebs-csi-driver/iam.tf: -------------------------------------------------------------------------------- 1 | module "ebs_csi_controller_role" { 2 | depends_on = [aws_iam_policy.ebs_csi_driver] 3 | source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc" 4 | create_role = true 5 | role_name = "${var.cluster_name}-ebs-csi-controller" 6 | provider_url = var.cluster_identity_oidc_provider 7 | role_policy_arns = [ 8 | "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy", 9 | aws_iam_policy.ebs_csi_driver.arn 10 | ] 11 | oidc_fully_qualified_subjects = ["system:serviceaccount:${var.namespace}:${var.service_account_name}"] 12 | } 13 | 14 | data "http" "aws-ebs-csi-driver-policy" { 15 | url = "https://raw.githubusercontent.com/kubernetes-sigs/aws-ebs-csi-driver/helm-chart-aws-ebs-csi-driver-${var.helm_chart_version}/docs/example-iam-policy.json" 16 | 17 | request_headers = { 18 | Accept = "application/json" 19 | } 20 | } 21 | 22 | resource "local_file" "aws-ebs-csi-driver-policy" { 23 | depends_on = [data.http.aws-ebs-csi-driver-policy] 24 | content = data.http.aws-ebs-csi-driver-policy.response_body 25 | filename = "${path.module}/downloaded-ebs-csi-driver-iam-policy.json" 26 | } 27 | 28 | resource "aws_iam_policy" "ebs_csi_driver" { 29 | depends_on = [data.http.aws-ebs-csi-driver-policy] 30 | name = "${var.cluster_name}-ebs-csi-driver" 31 | path = "/" 32 | description = "Policy for EBS CSI driver service" 33 | 34 | policy = data.http.aws-ebs-csi-driver-policy.response_body 35 | } 36 | -------------------------------------------------------------------------------- /modules/vpc/variable.tf: -------------------------------------------------------------------------------- 1 | variable "tfname" { 2 | description = "Tf Name. local.name value" 3 | type = string 4 | } 5 | 6 | variable "azs" { 7 | description = "The list of AZ to use" 8 | type = list(any) 9 | } 10 | 11 | variable "cidr" { 12 | description = "(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`" 13 | type = string 14 | default = "10.0.0.0/16" 15 | } 16 | 17 | variable "ipv6_cidr" { 18 | description = "(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`" 19 | type = string 20 | default = null 21 | } 22 | 23 | variable "enable_flow_log" { 24 | description = "Whether or not to enable VPC Flow Logs" 25 | type = bool 26 | default = false 27 | } 28 | 29 | # Public subnets 30 | variable "create_subnet_public" { 31 | description = "Create the public subnet?" 32 | type = bool 33 | default = true 34 | } 35 | 36 | # Private subnets 37 | variable "create_subnet_private" { 38 | description = "Create the private subnet?" 39 | type = bool 40 | default = true 41 | } 42 | variable "create_nat_gateway" { 43 | description = "Create the Nat gateway?" 44 | type = bool 45 | default = false 46 | } 47 | variable "one_nat_gateway_per_az" { 48 | description = "One Nat per AZ?" 49 | default = true 50 | type = bool 51 | } 52 | 53 | # Data subnets 54 | variable "create_subnet_private_isolated" { 55 | description = "Create the private isolated subnet?" 56 | type = bool 57 | default = true 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/iam.tf: -------------------------------------------------------------------------------- 1 | data "http" "aws-lb-controller-policy" { 2 | url = "https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v${var.aws_lb_controller_version}/docs/install/iam_policy.json" 3 | 4 | request_headers = { 5 | Accept = "application/json" 6 | } 7 | } 8 | 9 | resource "local_file" "aws-lb-controller-policy" { 10 | depends_on = [data.http.aws-lb-controller-policy] 11 | content = data.http.aws-lb-controller-policy.response_body 12 | filename = "${path.module}/downloaded-iam-policy.json" 13 | } 14 | 15 | resource "aws_iam_policy" "kubernetes_alb_controller" { 16 | depends_on = [data.http.aws-lb-controller-policy] 17 | name = "${var.cluster_name}-alb-controller" 18 | path = "/" 19 | description = "Policy for load balancer controller service" 20 | 21 | policy = data.http.aws-lb-controller-policy.response_body 22 | } 23 | 24 | # Role 25 | data "aws_iam_policy_document" "kubernetes_alb_controller_assume" { 26 | 27 | statement { 28 | actions = ["sts:AssumeRoleWithWebIdentity"] 29 | 30 | principals { 31 | type = "Federated" 32 | identifiers = [var.cluster_identity_oidc_issuer_arn] 33 | } 34 | 35 | condition { 36 | test = "StringEquals" 37 | variable = "${replace(var.cluster_identity_oidc_issuer, "https://", "")}:sub" 38 | 39 | values = [ 40 | "system:serviceaccount:${var.namespace}:${var.service_account_name}", 41 | ] 42 | } 43 | 44 | condition { 45 | test = "StringEquals" 46 | variable = "${replace(var.cluster_identity_oidc_issuer, "https://", "")}:aud" 47 | 48 | values = [ 49 | "sts.amazonaws.com" 50 | ] 51 | } 52 | 53 | effect = "Allow" 54 | } 55 | } 56 | 57 | resource "aws_iam_role" "kubernetes_alb_controller" { 58 | name = "${var.cluster_name}-alb-controller" 59 | assume_role_policy = data.aws_iam_policy_document.kubernetes_alb_controller_assume.json 60 | } 61 | 62 | resource "aws_iam_role_policy_attachment" "kubernetes_alb_controller" { 63 | role = aws_iam_role.kubernetes_alb_controller.name 64 | policy_arn = aws_iam_policy.kubernetes_alb_controller.arn 65 | } 66 | -------------------------------------------------------------------------------- /docs/terraform-state-management/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 4.47 | 7 | 8 | ## Providers 9 | 10 | | Name | Version | 11 | |------|---------| 12 | | [aws](#provider\_aws) | >= 4.47 | 13 | 14 | ## Modules 15 | 16 | No modules. 17 | 18 | ## Resources 19 | 20 | | Name | Type | 21 | |------|------| 22 | | [aws_dynamodb_table.terraform_locks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dynamodb_table) | resource | 23 | | [aws_s3_bucket.terraform_state](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource | 24 | | [aws_s3_bucket_public_access_block.public_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource | 25 | | [aws_s3_bucket_server_side_encryption_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource | 26 | | [aws_s3_bucket_versioning.enabled](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource | 27 | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | 28 | 29 | ## Inputs 30 | 31 | | Name | Description | Type | Default | Required | 32 | |------|-------------|------|---------|:--------:| 33 | | [bucket\_name](#input\_bucket\_name) | Name of the bucket to be created to salve the tf state | `string` | `"terraform_state_artefact"` | no | 34 | | [dynamodb\_table\_name](#input\_dynamodb\_table\_name) | Name of the bucket to be created to salve the tf state | `string` | `"terraform_lock"` | no | 35 | 36 | ## Outputs 37 | 38 | | Name | Description | 39 | |------|-------------| 40 | | [dynamodb\_table\_name](#output\_dynamodb\_table\_name) | The name of the DynamoDB table | 41 | | [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the S3 bucket | 42 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/es-parameter-store.tf: -------------------------------------------------------------------------------- 1 | data "aws_iam_policy_document" "external_secrets" { 2 | statement { 3 | actions = [ 4 | "secretsmanager:GetResourcePolicy", 5 | "secretsmanager:GetSecretValue", 6 | "secretsmanager:DescribeSecret", 7 | "secretsmanager:ListSecretVersionIds" 8 | ] 9 | resources = [ 10 | "*", 11 | ] 12 | effect = "Allow" 13 | } 14 | 15 | statement { 16 | actions = [ 17 | "ssm:GetParameter*" 18 | ] 19 | resources = [ 20 | "*", 21 | ] 22 | effect = "Allow" 23 | } 24 | 25 | } 26 | 27 | resource "aws_iam_policy" "external_secrets" { 28 | name = "${var.cluster_name}-external-secrets" 29 | path = "/" 30 | description = "Policy for external secrets service" 31 | 32 | policy = data.aws_iam_policy_document.external_secrets.json 33 | } 34 | 35 | # Role 36 | data "aws_iam_policy_document" "external_secrets_assume" { 37 | statement { 38 | actions = ["sts:AssumeRoleWithWebIdentity"] 39 | 40 | principals { 41 | type = "Federated" 42 | identifiers = [var.cluster_identity_oidc_issuer_arn] 43 | } 44 | 45 | condition { 46 | test = "StringEquals" 47 | variable = "${replace(var.cluster_identity_oidc_issuer, "https://", "")}:sub" 48 | 49 | values = [ 50 | for namespace in var.secret_store_namespace : 51 | "system:serviceaccount:${namespace}:${var.service_account_name}" 52 | ] 53 | } 54 | 55 | effect = "Allow" 56 | } 57 | } 58 | 59 | resource "aws_iam_role" "external_secrets" { 60 | name = "${var.cluster_name}-external-secrets" 61 | assume_role_policy = data.aws_iam_policy_document.external_secrets_assume.json 62 | } 63 | 64 | resource "aws_iam_role_policy_attachment" "external_secrets" { 65 | role = aws_iam_role.external_secrets.name 66 | policy_arn = aws_iam_policy.external_secrets.arn 67 | } 68 | 69 | 70 | resource "kubernetes_service_account" "es_parameter_store_sa" { 71 | for_each = toset(var.secret_store_namespace) 72 | metadata { 73 | name = var.service_account_name 74 | namespace = each.key 75 | annotations = { 76 | "eks.amazonaws.com/role-arn" = aws_iam_role.external_secrets.arn 77 | } 78 | } 79 | 80 | automount_service_account_token = true 81 | 82 | } 83 | -------------------------------------------------------------------------------- /modules/eks/eks.tf: -------------------------------------------------------------------------------- 1 | data "aws_default_tags" "tags" {} 2 | 3 | locals { 4 | name = var.tfname 5 | 6 | aws_auth_roles = concat( 7 | local.auth_roles_karpenter, 8 | # local.auth_roles_lb, 9 | var.auth_roles, 10 | [] 11 | ) 12 | 13 | aws_auth_users = concat( 14 | var.auth_users, 15 | [] 16 | ) 17 | } 18 | 19 | module "eks" { 20 | source = "terraform-aws-modules/eks/aws" 21 | version = "~> 21.1.5" 22 | 23 | name = local.name 24 | kubernetes_version = var.kubernetes_version 25 | 26 | endpoint_public_access = var.cluster_endpoint_public_access 27 | 28 | vpc_id = var.vpc_id 29 | subnet_ids = var.private_subnets 30 | control_plane_subnet_ids = var.private_subnets 31 | 32 | authentication_mode = "API_AND_CONFIG_MAP" 33 | enable_cluster_creator_admin_permissions = true 34 | 35 | # Fargate profiles use the cluster primary security group so these are not utilized 36 | create_security_group = false 37 | create_node_security_group = false 38 | 39 | # Get version of add on using: 40 | # aws eks describe-addon-versions --addon-name kube-proxy 41 | addons = { 42 | coredns = {} 43 | eks-pod-identity-agent = { 44 | before_compute = true 45 | } 46 | kube-proxy = {} 47 | vpc-cni = { 48 | before_compute = true 49 | } 50 | } 51 | 52 | 53 | fargate_profiles = { 54 | karpenter = { 55 | selectors = [ 56 | { namespace = "karpenter" } 57 | ] 58 | } 59 | vpc-cni = { 60 | selectors = [ 61 | { 62 | namespace = "kube-system" 63 | labels = { 64 | k8s-app = "aws-node" 65 | } 66 | } 67 | ] 68 | } 69 | coredns = { 70 | selectors = [ 71 | { 72 | namespace = "kube-system" 73 | labels = { 74 | k8s-app = "kube-dns" 75 | } 76 | } 77 | ] 78 | } 79 | } 80 | 81 | tags = merge(data.aws_default_tags.tags.tags, { 82 | # NOTE - if creating multiple security groups with this module, only tag the 83 | # security group that Karpenter should utilize with the following tag 84 | # (i.e. - at most, only one security group should have this tag in your account) 85 | "karpenter.sh/discovery" = local.name 86 | }) 87 | } 88 | -------------------------------------------------------------------------------- /generate-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Generate the README on all modules 4 | # Generate the mkdocs.yaml based on current folder 5 | # Search on subfolders to get all readme files 6 | # copy readme files to docs folder 7 | 8 | # Define the root directory and the modules directory 9 | ROOT_DIR="./" 10 | MODULES_DIR="${ROOT_DIR}/modules" 11 | DOCS_DIR="${ROOT_DIR}/docs" 12 | 13 | generate_doc_on_modules() { 14 | 15 | for dir in "${MODULES_DIR}"/*/; do 16 | echo "Generating README.md for $dir" 17 | terraform-docs markdown table "$dir" > "$dir/README.md" 18 | done 19 | } 20 | 21 | # Function to process each module 22 | process_module() { 23 | local module_name=$(basename "$1") 24 | 25 | # Check if README.md exists in the subfolder 26 | if [[ -f "$1/README.md" ]]; then 27 | echo "Processing $1/README.md" 28 | 29 | # Copy the README.md to the docs directory with a unique name 30 | mkdir -p "$DOCS_DIR/$module_name" 31 | cp "$1/README.md" "$DOCS_DIR/$module_name/README.md" 32 | 33 | # Append to the master index.md content 34 | MASTER_INDEX_CONTENT+="\n- [${module_name}](./${module_name}/README.md)" 35 | 36 | # Append to mkdocs.yml nav 37 | MKDOCS_CONFIG+=" - ${module_name}: ${module_name}/README.md\n" 38 | fi 39 | } 40 | 41 | generate_mkdocs() { 42 | 43 | # Ensure the docs directory exists 44 | mkdir -p "$DOCS_DIR" 45 | 46 | # Initialize the master index.md content 47 | MASTER_INDEX_CONTENT="# Terraform Modules Documentation\n\n## Modules\n" 48 | 49 | # Initialize mkdocs.yml configuration with theme 50 | MKDOCS_CONFIG="site_name: Terraform Modules Documentation\n\ndocs_dir: docs\n\ntheme:\n name: readthedocs\n\nnav:\n - Home: index.md\n" 51 | 52 | 53 | 54 | # Iterate over immediate subdirectories of the modules directory 55 | for dir in "${MODULES_DIR}"/*/; do 56 | process_module "$dir" 57 | done 58 | 59 | # Write the master index.md content to a file 60 | echo -e "$MASTER_INDEX_CONTENT" > "${DOCS_DIR}/index.md" 61 | 62 | # Write the mkdocs.yml configuration to a file 63 | echo -e "$MKDOCS_CONFIG" > "${ROOT_DIR}/mkdocs.yml" 64 | 65 | echo "Documentation generated successfully" 66 | } 67 | 68 | echo "Generating README on modules **********************" 69 | generate_doc_on_modules 70 | 71 | echo -e "\nGenerating mkdocs on modules **********************" 72 | generate_mkdocs 73 | 74 | echo "" 75 | mkdocs serve 76 | -------------------------------------------------------------------------------- /modules/vpc/vpc.tf: -------------------------------------------------------------------------------- 1 | data "aws_caller_identity" "current" {} 2 | data "aws_default_tags" "tags" {} 3 | 4 | locals { 5 | create_nat = var.create_subnet_public && var.create_subnet_private && var.create_nat_gateway 6 | name = var.tfname 7 | s3_bucket_name = "${local.name}-vpc-flow-logs-${data.aws_caller_identity.current.account_id}" 8 | az_length = length(var.azs) 9 | } 10 | 11 | # Elastic IPs for Nat Gateway 12 | resource "aws_eip" "nat" { 13 | count = ( 14 | local.create_nat ? 15 | var.one_nat_gateway_per_az ? local.az_length : 1 16 | : 0 17 | ) 18 | 19 | domain = "vpc" 20 | 21 | tags = merge( 22 | { "Name" = "${local.name}-nat-gateway" }, 23 | data.aws_default_tags.tags.tags 24 | ) 25 | } 26 | 27 | module "vpc" { 28 | source = "terraform-aws-modules/vpc/aws" 29 | version = "~> 5.0" 30 | 31 | name = local.name 32 | cidr = var.cidr 33 | # ipv6_cidr = var.ipv6_cidr 34 | 35 | azs = var.azs 36 | public_subnets = var.create_subnet_public ? [for k, v in var.azs : cidrsubnet(var.cidr, 4, k)] : null 37 | private_subnets = var.create_subnet_private ? [for k, v in var.azs : cidrsubnet(var.cidr, 4, k + 3)] : null 38 | database_subnets = var.create_subnet_private_isolated ? [for k, v in var.azs : cidrsubnet(var.cidr, 4, k + 6)] : null 39 | public_subnet_ipv6_prefixes = [for i in range(1, local.az_length + 1) : i] 40 | private_subnet_ipv6_prefixes = [for i in range(4, local.az_length + 4) : i] 41 | database_subnet_ipv6_prefixes = [for i in range(7, local.az_length + 7) : i] 42 | 43 | create_database_subnet_group = true 44 | create_database_subnet_route_table = true 45 | 46 | enable_nat_gateway = local.create_nat 47 | single_nat_gateway = var.one_nat_gateway_per_az ? false : true 48 | one_nat_gateway_per_az = var.one_nat_gateway_per_az ? true : false 49 | 50 | reuse_nat_ips = true 51 | external_nat_ip_ids = aws_eip.nat.*.id 52 | 53 | public_subnet_tags = { 54 | "kubernetes.io/role/elb" = 1 55 | } 56 | 57 | private_subnet_tags = { 58 | "kubernetes.io/role/internal-elb" = 1 59 | "karpenter.sh/discovery" = local.name # Tags subnets for Karpenter auto-discovery 60 | } 61 | 62 | 63 | enable_dns_hostnames = true 64 | enable_dns_support = true 65 | 66 | enable_ipv6 = true 67 | public_subnet_assign_ipv6_address_on_creation = true 68 | create_egress_only_igw = true 69 | 70 | } 71 | -------------------------------------------------------------------------------- /docs/eks-ebs-csi-driver/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [http](#requirement\_http) | >= 3.4 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [http](#provider\_http) | >= 3.4 | 17 | | [local](#provider\_local) | n/a | 18 | 19 | ## Modules 20 | 21 | | Name | Source | Version | 22 | |------|--------|---------| 23 | | [ebs\_csi\_controller\_role](#module\_ebs\_csi\_controller\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc | n/a | 24 | 25 | ## Resources 26 | 27 | | Name | Type | 28 | |------|------| 29 | | [aws_iam_policy.ebs_csi_driver](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 30 | | [helm_release.aws_ebs_csi_driver](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [local_file.aws-ebs-csi-driver-policy](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | 32 | | [http_http.aws-ebs-csi-driver-policy](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | 33 | 34 | ## Inputs 35 | 36 | | Name | Description | Type | Default | Required | 37 | |------|-------------|------|---------|:--------:| 38 | | [cluster\_identity\_oidc\_provider](#input\_cluster\_identity\_oidc\_provider) | The OIDC Identity provider for the cluster. | `string` | n/a | yes | 39 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 40 | | [helm\_chart\_version](#input\_helm\_chart\_version) | EBS CSI Driver Helm chart version. | `string` | `"v1.23.1"` | no | 41 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy the EBS CSI Driver Helm chart. | `string` | `"kube-system"` | no | 42 | | [service\_account\_name](#input\_service\_account\_name) | EBS CSI Driver Service Account Name | `string` | `"ebs-csi-controller-sa"` | no | 43 | 44 | ## Outputs 45 | 46 | No outputs. 47 | -------------------------------------------------------------------------------- /modules/eks-ebs-csi-driver/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [http](#requirement\_http) | >= 3.4 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [http](#provider\_http) | >= 3.4 | 17 | | [local](#provider\_local) | n/a | 18 | 19 | ## Modules 20 | 21 | | Name | Source | Version | 22 | |------|--------|---------| 23 | | [ebs\_csi\_controller\_role](#module\_ebs\_csi\_controller\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc | n/a | 24 | 25 | ## Resources 26 | 27 | | Name | Type | 28 | |------|------| 29 | | [aws_iam_policy.ebs_csi_driver](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 30 | | [helm_release.aws_ebs_csi_driver](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [local_file.aws-ebs-csi-driver-policy](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | 32 | | [http_http.aws-ebs-csi-driver-policy](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | 33 | 34 | ## Inputs 35 | 36 | | Name | Description | Type | Default | Required | 37 | |------|-------------|------|---------|:--------:| 38 | | [cluster\_identity\_oidc\_provider](#input\_cluster\_identity\_oidc\_provider) | The OIDC Identity provider for the cluster. | `string` | n/a | yes | 39 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 40 | | [helm\_chart\_version](#input\_helm\_chart\_version) | EBS CSI Driver Helm chart version. | `string` | `"v1.23.1"` | no | 41 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy the EBS CSI Driver Helm chart. | `string` | `"kube-system"` | no | 42 | | [service\_account\_name](#input\_service\_account\_name) | EBS CSI Driver Service Account Name | `string` | `"ebs-csi-controller-sa"` | no | 43 | 44 | ## Outputs 45 | 46 | No outputs. 47 | -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | data "aws_region" "current" {} 2 | data "aws_availability_zones" "available" {} 3 | data "aws_caller_identity" "current" {} 4 | 5 | locals { 6 | name = basename(path.cwd) 7 | region = data.aws_region.current.name 8 | 9 | azs = slice(data.aws_availability_zones.available.names, 0, var.qtt_az) 10 | 11 | } 12 | 13 | module "vpc" { 14 | source = "./modules/vpc" 15 | 16 | tfname = local.name 17 | cidr = var.cidr 18 | create_subnet_public = var.create_subnet_public 19 | create_subnet_private = var.create_subnet_private 20 | create_nat_gateway = var.create_nat_gateway 21 | one_nat_gateway_per_az = var.one_nat_gateway_per_az 22 | create_subnet_private_isolated = var.create_subnet_private_isolated 23 | 24 | azs = local.azs 25 | } 26 | 27 | module "eks" { 28 | source = "./modules/eks" 29 | 30 | tfname = local.name 31 | vpc_id = module.vpc.vpc_id 32 | private_subnets = module.vpc.private_subnets 33 | cluster_endpoint_public_access = var.cluster_endpoint_public_access 34 | kubernetes_version = var.kubernetes_version 35 | 36 | azs = local.azs 37 | } 38 | 39 | module "eks_rbac_default_roles" { 40 | depends_on = [module.eks] 41 | source = "./modules/eks-rbac-default-roles" 42 | } 43 | 44 | module "eks_loadbalancer" { 45 | depends_on = [module.eks] 46 | source = "./modules/eks-load-balancer-controller" 47 | 48 | cluster_name = module.eks.cluster_name 49 | aws_region = local.region 50 | cluster_identity_oidc_issuer = module.eks.oidc_provider 51 | cluster_identity_oidc_issuer_arn = module.eks.oidc_provider_arn 52 | helm_chart_version = "1.4.6" 53 | aws_lb_controller_version = "2.6.1" 54 | 55 | } 56 | 57 | resource "kubernetes_namespace" "es_secret_store_namespace" { 58 | depends_on = [module.eks] 59 | for_each = toset(var.es_secret_store_namespace) 60 | metadata { 61 | name = each.key 62 | } 63 | } 64 | 65 | module "eks-external-secrets" { 66 | depends_on = [module.eks, kubernetes_namespace.es_secret_store_namespace] 67 | source = "./modules/eks-external-secrets" 68 | 69 | cluster_name = module.eks.cluster_name 70 | aws_region = local.region 71 | helm_chart_version = "0.9.5" 72 | secret_store_namespace = var.es_secret_store_namespace 73 | cluster_identity_oidc_issuer = module.eks.oidc_provider 74 | cluster_identity_oidc_issuer_arn = module.eks.oidc_provider_arn 75 | } 76 | 77 | module "eks-ebs-csi-driver" { 78 | depends_on = [module.eks] 79 | source = "./modules/eks-ebs-csi-driver" 80 | 81 | cluster_name = module.eks.cluster_name 82 | helm_chart_version = "2.23.1" 83 | cluster_identity_oidc_provider = module.eks.oidc_provider 84 | } 85 | -------------------------------------------------------------------------------- /provider.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = var.aws_region 3 | 4 | default_tags { 5 | tags = { 6 | Environment = "Test" 7 | # Environment = local.name 8 | } 9 | } 10 | 11 | } 12 | 13 | 14 | data "aws_eks_cluster_auth" "current" { 15 | name = module.eks.cluster_name 16 | } 17 | 18 | provider "kubernetes" { 19 | host = module.eks.cluster_endpoint 20 | cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) 21 | token = data.aws_eks_cluster_auth.current.token 22 | 23 | # exec { 24 | # api_version = "client.authentication.k8s.io/v1beta1" 25 | # command = "aws" 26 | # # This requires the awscli to be installed locally where Terraform is executed 27 | # args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] 28 | # } 29 | } 30 | 31 | provider "helm" { 32 | kubernetes { 33 | host = module.eks.cluster_endpoint 34 | cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) 35 | token = data.aws_eks_cluster_auth.current.token 36 | 37 | # exec { 38 | # api_version = "client.authentication.k8s.io/v1beta1" 39 | # command = "aws" 40 | # # This requires the awscli to be installed locally where Terraform is executed 41 | # args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] 42 | # } 43 | } 44 | } 45 | 46 | provider "kubectl" { 47 | apply_retry_count = 5 48 | load_config_file = false 49 | host = module.eks.cluster_endpoint 50 | cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) 51 | token = data.aws_eks_cluster_auth.current.token 52 | 53 | # exec { 54 | # api_version = "client.authentication.k8s.io/v1beta1" 55 | # command = "aws" 56 | # # This requires the awscli to be installed locally where Terraform is executed 57 | # args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] 58 | # } 59 | } 60 | 61 | 62 | ## 63 | # If the module.eks lost his config, use the following command 64 | ## 65 | 66 | # data "aws_eks_cluster_auth" "current" { 67 | # name = local.name 68 | # } 69 | # data "aws_eks_cluster" "cluster" { 70 | # name = local.name 71 | # # } 72 | 73 | # provider "kubernetes" { 74 | # host = data.aws_eks_cluster.cluster.endpoint 75 | # cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data) 76 | # token = data.aws_eks_cluster_auth.current.token 77 | # } 78 | 79 | # provider "helm" { 80 | # kubernetes { 81 | # host = data.aws_eks_cluster.cluster.endpoint 82 | # cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data) 83 | # token = data.aws_eks_cluster_auth.current.token 84 | # } 85 | # } 86 | 87 | # provider "kubectl" { 88 | # host = data.aws_eks_cluster.cluster.endpoint 89 | # cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data) 90 | # token = data.aws_eks_cluster_auth.current.token 91 | # apply_retry_count = 5 92 | # load_config_file = false 93 | # } 94 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | variable "aws_region" { 2 | description = "AWS Region to run the EKS" 3 | type = string 4 | } 5 | 6 | variable "qtt_az" { 7 | description = "Number of Zones to use" 8 | type = number 9 | default = 3 10 | } 11 | 12 | ########################################### 13 | ############# VPC Variables ############### 14 | ########################################### 15 | variable "cidr" { 16 | description = "(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`" 17 | type = string 18 | default = "10.0.0.0/16" 19 | } 20 | 21 | variable "ipv6_cidr" { 22 | description = "(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`" 23 | type = string 24 | default = null 25 | } 26 | 27 | variable "tags" { 28 | description = "A map of tags to add to all resources" 29 | type = map(string) 30 | default = {} 31 | } 32 | 33 | variable "enable_flow_log" { 34 | description = "Whether or not to enable VPC Flow Logs" 35 | type = bool 36 | default = false 37 | } 38 | 39 | # Public subnets 40 | variable "create_subnet_public" { 41 | description = "Create the public subnet?" 42 | type = bool 43 | default = true 44 | } 45 | 46 | # Private subnets 47 | variable "create_subnet_private" { 48 | description = "Create the private subnet?" 49 | type = bool 50 | default = true 51 | } 52 | variable "create_nat_gateway" { 53 | description = "Create the Nat gateway?" 54 | type = bool 55 | default = false 56 | } 57 | variable "one_nat_gateway_per_az" { 58 | description = "One Nat per AZ?" 59 | default = true 60 | type = bool 61 | } 62 | 63 | # Data subnets 64 | variable "create_subnet_private_isolated" { 65 | description = "Create the private isolated subnet?" 66 | type = bool 67 | default = true 68 | } 69 | 70 | 71 | 72 | ########################################### 73 | ############# EKS Variables ############### 74 | ########################################### 75 | variable "kubernetes_version" { 76 | description = "Kubernetes Version" 77 | type = string 78 | } 79 | 80 | variable "cluster_endpoint_public_access" { 81 | description = "(Optional) Cluster Endpoint with public access" 82 | type = bool 83 | default = false 84 | } 85 | 86 | ########################################### 87 | ############# tf-backend ############### 88 | ########################################### 89 | variable "create_state_storage" { 90 | description = "(Optional) Create the state storage S3 and DynamoDB to save the state and lock?" 91 | type = bool 92 | default = true 93 | } 94 | 95 | ########################################### 96 | ############# outputs ############### 97 | ########################################### 98 | variable "all_outputs" { 99 | description = "(Optional) Show all outputs? Hide modules output" 100 | type = bool 101 | default = true 102 | } 103 | 104 | 105 | ########################################### 106 | ############# External Secrets ############### 107 | ########################################### 108 | variable "es_secret_store_namespace" { 109 | type = list(string) 110 | description = "Namespaces to create the external secrets secret store" 111 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | This repository provides a Terraform configuration to deploy and manage an Amazon EKS (Elastic Kubernetes Service) cluster on AWS. It leverages modular Terraform code to provision networking, IAM roles, storage, RBAC, and various EKS add-ons, enabling a production-ready Kubernetes environment. 4 | 5 | ## Architecture 6 | 7 | The project is organized into reusable modules located in the `modules/` directory. Each module encapsulates specific infrastructure components or operational features for the EKS cluster. 8 | 9 | ### Main Modules 10 | 11 | - **eks**: Provisions the core EKS cluster, including control plane, node groups, Fargate profiles, and cluster-level IAM roles. 12 | - **vpc**: Creates the Virtual Private Cloud, subnets, NAT gateways, and related networking resources required for EKS. 13 | - **eks-ebs-csi-driver**: Deploys the AWS EBS CSI driver for dynamic storage provisioning in Kubernetes. 14 | - **eks-external-secrets**: Integrates Kubernetes with AWS Secrets Manager and Parameter Store, enabling secure secret management. 15 | - **eks-load-balancer-controller**: Installs the AWS Load Balancer Controller for managing AWS ALBs and NLBs via Kubernetes resources. 16 | - **eks-rbac-default-roles**: Sets up default RBAC roles for Kubernetes users and groups. 17 | - **terraform-state-management**: (If present) Manages S3 and DynamoDB resources for storing and locking Terraform state files. 18 | 19 | ## Usage 20 | 21 | ### Prepare your project 22 | 23 | This command will install the providers needed for the project 24 | 25 | ``` 26 | terraform init 27 | ``` 28 | 29 | ### Create the tfvars file 30 | 31 | Rename the terraform.tfvars.example file to terraform.tfvars. It has the a sample to use the project 32 | 33 | ``` 34 | mv terraform.tfvars.example terraform.tfvars 35 | ``` 36 | 37 | ### Creating the storage for tfstate and lock 38 | 39 | To work as a team, and to the CI/CD is important to save the tfstate file of each environment 40 | 41 | To work with the team, is important create a lock beatween everyone to noone run as same time the cloudformation, but create a pipeline is the best option 42 | 43 | To save the state on S3 and use the dynamodb as lock, see the file tf-backend.tf and tf-backend-outputs.tf 44 | 45 | Edit the tf-backend.tf with your informations. See the information of module: [cloudposse/tfstate-backend](https://registry.terraform.io/modules/cloudposse/tfstate-backend/aws/latest) 46 | 47 | ``` 48 | code tf-backend.tf 49 | ``` 50 | 51 | Run the apply for this resource to create the TF backend file 52 | 53 | ``` 54 | terraform apply -target=module.terraform_state_backend 55 | ``` 56 | 57 | After runned it, verify your backend.tf file 58 | 59 | ``` 60 | cat backend.tf 61 | ``` 62 | 63 | After verify the configuration generated by the module, run the init again to load the configuration 64 | 65 | ``` 66 | terraform init -force-copy 67 | ``` 68 | 69 | ### Create the EKS 70 | ``` 71 | terraform plan 72 | terraform apply 73 | ``` 74 | 75 | ## Documentation 76 | 77 | - Each module contains its own `README.md` with details about inputs, outputs, and resources. 78 | - See the [docs/index.md](docs/index.md) for an overview and links to module documentation. 79 | 80 | ## Modules Directory 81 | 82 | - [modules/eks](modules/eks/README.md): EKS cluster provisioning. 83 | - [modules/vpc](modules/vpc/README.md): VPC and networking. 84 | - [modules/eks-ebs-csi-driver](modules/eks-ebs-csi-driver/README.md): EBS CSI driver. 85 | - [modules/eks-external-secrets](modules/eks-external-secrets/README.md): External Secrets integration. 86 | - [modules/eks-load-balancer-controller](modules/eks-load-balancer-controller/README.md): Load Balancer Controller. 87 | - [modules/eks-rbac-default-roles](modules/eks-rbac-default-roles/README.md): Default RBAC roles. 88 | 89 | Go on each module's documentation to his specific configuration options and outputs. 90 | -------------------------------------------------------------------------------- /docs/eks-load-balancer-controller/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [http](#requirement\_http) | >= 3.4 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [http](#provider\_http) | >= 3.4 | 17 | | [local](#provider\_local) | n/a | 18 | 19 | ## Modules 20 | 21 | No modules. 22 | 23 | ## Resources 24 | 25 | | Name | Type | 26 | |------|------| 27 | | [aws_iam_policy.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 28 | | [aws_iam_role.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | 29 | | [aws_iam_role_policy_attachment.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | 30 | | [helm_release.alb_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [local_file.aws-lb-controller-policy](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | 32 | | [aws_iam_policy_document.kubernetes_alb_controller_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 33 | | [http_http.aws-lb-controller-policy](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | 34 | 35 | ## Inputs 36 | 37 | | Name | Description | Type | Default | Required | 38 | |------|-------------|------|---------|:--------:| 39 | | [aws\_lb\_controller\_version](#input\_aws\_lb\_controller\_version) | ALB Controller Helm chart version. | `string` | `"2.6.1"` | no | 40 | | [aws\_region](#input\_aws\_region) | AWS region where secrets are stored. | `string` | n/a | yes | 41 | | [cluster\_identity\_oidc\_issuer](#input\_cluster\_identity\_oidc\_issuer) | The OIDC Identity issuer for the cluster. | `string` | n/a | yes | 42 | | [cluster\_identity\_oidc\_issuer\_arn](#input\_cluster\_identity\_oidc\_issuer\_arn) | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account. | `string` | n/a | yes | 43 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 44 | | [helm\_chart\_version](#input\_helm\_chart\_version) | ALB Controller Helm chart version. | `string` | `"1.4.6"` | no | 45 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy ALB Controller Helm chart. | `string` | `"lb-controller"` | no | 46 | | [service\_account\_name](#input\_service\_account\_name) | ALB Controller service account name | `string` | `"aws-load-balancer-controller"` | no | 47 | | [settings](#input\_settings) | Additional settings which will be passed to the Helm chart values. | `map` | `{}` | no | 48 | 49 | ## Outputs 50 | 51 | | Name | Description | 52 | |------|-------------| 53 | | [helm\_loadbalancer\_controller\_namespace](#output\_helm\_loadbalancer\_controller\_namespace) | n/a | 54 | | [helm\_loadbalancer\_controller\_version](#output\_helm\_loadbalancer\_controller\_version) | n/a | 55 | | [lb-controller-role](#output\_lb-controller-role) | Role to Load Balancer Controller use to create and configure the load balancers | 56 | -------------------------------------------------------------------------------- /modules/eks-load-balancer-controller/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [http](#requirement\_http) | >= 3.4 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [http](#provider\_http) | >= 3.4 | 17 | | [local](#provider\_local) | n/a | 18 | 19 | ## Modules 20 | 21 | No modules. 22 | 23 | ## Resources 24 | 25 | | Name | Type | 26 | |------|------| 27 | | [aws_iam_policy.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 28 | | [aws_iam_role.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | 29 | | [aws_iam_role_policy_attachment.kubernetes_alb_controller](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | 30 | | [helm_release.alb_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [local_file.aws-lb-controller-policy](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource | 32 | | [aws_iam_policy_document.kubernetes_alb_controller_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 33 | | [http_http.aws-lb-controller-policy](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | 34 | 35 | ## Inputs 36 | 37 | | Name | Description | Type | Default | Required | 38 | |------|-------------|------|---------|:--------:| 39 | | [aws\_lb\_controller\_version](#input\_aws\_lb\_controller\_version) | ALB Controller Helm chart version. | `string` | `"2.6.1"` | no | 40 | | [aws\_region](#input\_aws\_region) | AWS region where secrets are stored. | `string` | n/a | yes | 41 | | [cluster\_identity\_oidc\_issuer](#input\_cluster\_identity\_oidc\_issuer) | The OIDC Identity issuer for the cluster. | `string` | n/a | yes | 42 | | [cluster\_identity\_oidc\_issuer\_arn](#input\_cluster\_identity\_oidc\_issuer\_arn) | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account. | `string` | n/a | yes | 43 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 44 | | [helm\_chart\_version](#input\_helm\_chart\_version) | ALB Controller Helm chart version. | `string` | `"1.4.6"` | no | 45 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy ALB Controller Helm chart. | `string` | `"lb-controller"` | no | 46 | | [service\_account\_name](#input\_service\_account\_name) | ALB Controller service account name | `string` | `"aws-load-balancer-controller"` | no | 47 | | [settings](#input\_settings) | Additional settings which will be passed to the Helm chart values. | `map` | `{}` | no | 48 | 49 | ## Outputs 50 | 51 | | Name | Description | 52 | |------|-------------| 53 | | [helm\_loadbalancer\_controller\_namespace](#output\_helm\_loadbalancer\_controller\_namespace) | n/a | 54 | | [helm\_loadbalancer\_controller\_version](#output\_helm\_loadbalancer\_controller\_version) | n/a | 55 | | [lb-controller-role](#output\_lb-controller-role) | Role to Load Balancer Controller use to create and configure the load balancers | 56 | -------------------------------------------------------------------------------- /docs/eks-external-secrets/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [kubectl](#provider\_kubectl) | >= 1.14 | 17 | | [kubernetes](#provider\_kubernetes) | n/a | 18 | 19 | ## Modules 20 | 21 | No modules. 22 | 23 | ## Resources 24 | 25 | | Name | Type | 26 | |------|------| 27 | | [aws_iam_policy.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 28 | | [aws_iam_role.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | 29 | | [aws_iam_role_policy_attachment.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | 30 | | [helm_release.external_secrets](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [kubectl_manifest.es_parameter_store_secret_store_deployment](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 32 | | [kubernetes_service_account.es_parameter_store_sa](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource | 33 | | [aws_iam_policy_document.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 34 | | [aws_iam_policy_document.external_secrets_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 35 | 36 | ## Inputs 37 | 38 | | Name | Description | Type | Default | Required | 39 | |------|-------------|------|---------|:--------:| 40 | | [aws\_region](#input\_aws\_region) | AWS region where secrets are stored. | `string` | n/a | yes | 41 | | [cluster\_identity\_oidc\_issuer](#input\_cluster\_identity\_oidc\_issuer) | The OIDC Identity issuer for the cluster. | `string` | n/a | yes | 42 | | [cluster\_identity\_oidc\_issuer\_arn](#input\_cluster\_identity\_oidc\_issuer\_arn) | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account. | `string` | n/a | yes | 43 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 44 | | [helm\_chart\_version](#input\_helm\_chart\_version) | External Secrets Helm chart version. | `string` | `"0.9.5"` | no | 45 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy External Secrets Helm chart. | `string` | `"external-secrets"` | no | 46 | | [parameter\_store\_prefix](#input\_parameter\_store\_prefix) | (Optional) Prefix of parameter store to allowed access | `string` | `""` | no | 47 | | [secret\_store\_namespace](#input\_secret\_store\_namespace) | Namespaces to create the external secrets secret store | `list(string)` | n/a | yes | 48 | | [service\_account\_name](#input\_service\_account\_name) | External Secret service account name | `string` | `"external-secret-sa"` | no | 49 | 50 | ## Outputs 51 | 52 | | Name | Description | 53 | |------|-------------| 54 | | [helm\_external\_secrets\_namespace](#output\_helm\_external\_secrets\_namespace) | n/a | 55 | | [helm\_external\_secrets\_version](#output\_helm\_external\_secrets\_version) | n/a | 56 | -------------------------------------------------------------------------------- /modules/eks-external-secrets/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 9 | 10 | ## Providers 11 | 12 | | Name | Version | 13 | |------|---------| 14 | | [aws](#provider\_aws) | >= 5.20 | 15 | | [helm](#provider\_helm) | >= 2.11 | 16 | | [kubectl](#provider\_kubectl) | >= 1.14 | 17 | | [kubernetes](#provider\_kubernetes) | n/a | 18 | 19 | ## Modules 20 | 21 | No modules. 22 | 23 | ## Resources 24 | 25 | | Name | Type | 26 | |------|------| 27 | | [aws_iam_policy.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | 28 | | [aws_iam_role.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | 29 | | [aws_iam_role_policy_attachment.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | 30 | | [helm_release.external_secrets](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 31 | | [kubectl_manifest.es_parameter_store_secret_store_deployment](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 32 | | [kubernetes_service_account.es_parameter_store_sa](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource | 33 | | [aws_iam_policy_document.external_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 34 | | [aws_iam_policy_document.external_secrets_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | 35 | 36 | ## Inputs 37 | 38 | | Name | Description | Type | Default | Required | 39 | |------|-------------|------|---------|:--------:| 40 | | [aws\_region](#input\_aws\_region) | AWS region where secrets are stored. | `string` | n/a | yes | 41 | | [cluster\_identity\_oidc\_issuer](#input\_cluster\_identity\_oidc\_issuer) | The OIDC Identity issuer for the cluster. | `string` | n/a | yes | 42 | | [cluster\_identity\_oidc\_issuer\_arn](#input\_cluster\_identity\_oidc\_issuer\_arn) | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account. | `string` | n/a | yes | 43 | | [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes | 44 | | [helm\_chart\_version](#input\_helm\_chart\_version) | External Secrets Helm chart version. | `string` | `"0.9.5"` | no | 45 | | [namespace](#input\_namespace) | Kubernetes namespace to deploy External Secrets Helm chart. | `string` | `"external-secrets"` | no | 46 | | [parameter\_store\_prefix](#input\_parameter\_store\_prefix) | (Optional) Prefix of parameter store to allowed access | `string` | `""` | no | 47 | | [secret\_store\_namespace](#input\_secret\_store\_namespace) | Namespaces to create the external secrets secret store | `list(string)` | n/a | yes | 48 | | [service\_account\_name](#input\_service\_account\_name) | External Secret service account name | `string` | `"external-secret-sa"` | no | 49 | 50 | ## Outputs 51 | 52 | | Name | Description | 53 | |------|-------------| 54 | | [helm\_external\_secrets\_namespace](#output\_helm\_external\_secrets\_namespace) | n/a | 55 | | [helm\_external\_secrets\_version](#output\_helm\_external\_secrets\_version) | n/a | 56 | -------------------------------------------------------------------------------- /modules/eks/karpenter.tf: -------------------------------------------------------------------------------- 1 | # Required for public ECR where Karpenter artifacts are hosted 2 | provider "aws" { 3 | region = "us-east-1" 4 | alias = "virginia" 5 | } 6 | data "aws_ecrpublic_authorization_token" "token" { 7 | provider = aws.virginia 8 | } 9 | 10 | 11 | locals { 12 | auth_roles_karpenter = [ 13 | # We need to add in the Karpenter node IAM role for nodes launched by Karpenter 14 | { 15 | rolearn = module.karpenter.role_arn 16 | username = "system:node:{{EC2PrivateDNSName}}" 17 | groups = [ 18 | "system:bootstrappers", 19 | "system:nodes", 20 | ] 21 | }, 22 | ] 23 | } 24 | 25 | module "karpenter" { 26 | source = "terraform-aws-modules/eks/aws//modules/karpenter" 27 | 28 | cluster_name = module.eks.cluster_name 29 | node_iam_role_additional_policies = { 30 | AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" 31 | } 32 | 33 | # tags = local.tags 34 | } 35 | 36 | resource "helm_release" "karpenter" { 37 | depends_on = [module.eks] 38 | 39 | namespace = "karpenter" 40 | create_namespace = true 41 | 42 | name = "karpenter" 43 | repository = "oci://public.ecr.aws/karpenter" 44 | repository_username = data.aws_ecrpublic_authorization_token.token.user_name 45 | repository_password = data.aws_ecrpublic_authorization_token.token.password 46 | chart = "karpenter" 47 | version = var.karpenter_helm_chart_version 48 | 49 | set { 50 | name = "settings.aws.clusterName" 51 | value = module.eks.cluster_name 52 | } 53 | 54 | set { 55 | name = "settings.aws.clusterEndpoint" 56 | value = module.eks.cluster_endpoint 57 | } 58 | 59 | set { 60 | name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn" 61 | value = module.karpenter.irsa_arn 62 | } 63 | 64 | set { 65 | name = "settings.aws.defaultInstanceProfile" 66 | value = module.karpenter.instance_profile_name 67 | } 68 | 69 | set { 70 | name = "settings.aws.interruptionQueueName" 71 | value = module.karpenter.queue_name 72 | } 73 | } 74 | 75 | 76 | resource "kubectl_manifest" "karpenter_provisioner" { 77 | yaml_body = <<-YAML 78 | apiVersion: karpenter.sh/v1alpha5 79 | kind: Provisioner 80 | metadata: 81 | name: default 82 | spec: 83 | requirements: 84 | - key: "karpenter.k8s.aws/instance-category" 85 | operator: In 86 | values: ["c", "m"] 87 | - key: "karpenter.k8s.aws/instance-cpu" 88 | operator: In 89 | values: ["8", "16", "32"] 90 | - key: "karpenter.k8s.aws/instance-hypervisor" 91 | operator: In 92 | values: ["nitro"] 93 | - key: "topology.kubernetes.io/zone" 94 | operator: In 95 | values: ${jsonencode(var.azs)} 96 | - key: "kubernetes.io/arch" 97 | operator: In 98 | values: ["arm64", "amd64"] 99 | - key: "karpenter.sh/capacity-type" # If not included, the webhook for the AWS cloud provider will default to on-demand 100 | operator: In 101 | values: ["spot", "on-demand"] 102 | kubeletConfiguration: 103 | containerRuntime: containerd 104 | maxPods: 110 105 | imageGCHighThresholdPercent: 85 106 | imageGCLowThresholdPercent: 80 107 | limits: 108 | resources: 109 | cpu: 1000 110 | consolidation: 111 | enabled: true 112 | providerRef: 113 | name: default 114 | ttlSecondsUntilExpired: 604800 # 7 Days = 7 * 24 * 60 * 60 Seconds 115 | YAML 116 | 117 | depends_on = [ 118 | helm_release.karpenter 119 | ] 120 | } 121 | 122 | resource "kubectl_manifest" "karpenter_node_template" { 123 | yaml_body = <<-YAML 124 | apiVersion: karpenter.k8s.aws/v1alpha1 125 | kind: AWSNodeTemplate 126 | metadata: 127 | name: default 128 | spec: 129 | subnetSelector: 130 | karpenter.sh/discovery: ${module.eks.cluster_name} 131 | securityGroupSelector: 132 | karpenter.sh/discovery: ${module.eks.cluster_name} 133 | tags: 134 | karpenter.sh/discovery: ${module.eks.cluster_name} 135 | YAML 136 | 137 | depends_on = [ 138 | helm_release.karpenter 139 | ] 140 | } 141 | 142 | # Example deployment using the [pause image](https://www.ianlewis.org/en/almighty-pause-container) 143 | # and starts with zero replicas 144 | resource "kubectl_manifest" "karpenter_example_deployment" { 145 | yaml_body = <<-YAML 146 | apiVersion: apps/v1 147 | kind: Deployment 148 | metadata: 149 | name: inflate 150 | spec: 151 | replicas: 0 152 | selector: 153 | matchLabels: 154 | app: inflate 155 | template: 156 | metadata: 157 | labels: 158 | app: inflate 159 | spec: 160 | terminationGracePeriodSeconds: 0 161 | containers: 162 | - name: inflate 163 | image: public.ecr.aws/eks-distro/kubernetes/pause:3.7 164 | resources: 165 | requests: 166 | cpu: 1 167 | YAML 168 | 169 | depends_on = [ 170 | helm_release.karpenter 171 | ] 172 | } 173 | -------------------------------------------------------------------------------- /modules/eks/eks-outputs.tf: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Cluster 3 | ################################################################################ 4 | 5 | output "cluster_arn" { 6 | description = "The Amazon Resource Name (ARN) of the cluster" 7 | value = module.eks.cluster_arn 8 | } 9 | 10 | output "cluster_certificate_authority_data" { 11 | description = "Base64 encoded certificate data required to communicate with the cluster" 12 | value = module.eks.cluster_certificate_authority_data 13 | } 14 | 15 | output "cluster_endpoint" { 16 | description = "Endpoint for your Kubernetes API server" 17 | value = module.eks.cluster_endpoint 18 | } 19 | 20 | output "cluster_id" { 21 | description = "The ID of the EKS cluster. Note: currently a value is returned only for local EKS clusters created on Outposts" 22 | value = module.eks.cluster_id 23 | } 24 | 25 | output "cluster_name" { 26 | description = "The name of the EKS cluster" 27 | value = module.eks.cluster_name 28 | } 29 | 30 | output "cluster_oidc_issuer_url" { 31 | description = "The URL on the EKS cluster for the OpenID Connect identity provider" 32 | value = module.eks.cluster_oidc_issuer_url 33 | } 34 | 35 | output "cluster_platform_version" { 36 | description = "Platform version for the cluster" 37 | value = module.eks.cluster_platform_version 38 | } 39 | 40 | output "cluster_status" { 41 | description = "Status of the EKS cluster. One of `CREATING`, `ACTIVE`, `DELETING`, `FAILED`" 42 | value = module.eks.cluster_status 43 | } 44 | 45 | output "cluster_primary_security_group_id" { 46 | description = "Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console" 47 | value = module.eks.cluster_primary_security_group_id 48 | } 49 | 50 | ################################################################################ 51 | # KMS Key 52 | ################################################################################ 53 | 54 | output "kms_key_arn" { 55 | description = "The Amazon Resource Name (ARN) of the key" 56 | value = module.eks.kms_key_arn 57 | } 58 | 59 | output "kms_key_id" { 60 | description = "The globally unique identifier for the key" 61 | value = module.eks.kms_key_id 62 | } 63 | 64 | output "kms_key_policy" { 65 | description = "The IAM resource policy set on the key" 66 | value = module.eks.kms_key_policy 67 | } 68 | 69 | ################################################################################ 70 | # Security Group 71 | ################################################################################ 72 | 73 | output "cluster_security_group_arn" { 74 | description = "Amazon Resource Name (ARN) of the cluster security group" 75 | value = module.eks.cluster_security_group_arn 76 | } 77 | 78 | output "cluster_security_group_id" { 79 | description = "ID of the cluster security group" 80 | value = module.eks.cluster_security_group_id 81 | } 82 | 83 | ################################################################################ 84 | # Node Security Group 85 | ################################################################################ 86 | 87 | output "node_security_group_arn" { 88 | description = "Amazon Resource Name (ARN) of the node shared security group" 89 | value = module.eks.node_security_group_arn 90 | } 91 | 92 | output "node_security_group_id" { 93 | description = "ID of the node shared security group" 94 | value = module.eks.node_security_group_id 95 | } 96 | 97 | ################################################################################ 98 | # IRSA 99 | ################################################################################ 100 | 101 | output "oidc_provider" { 102 | description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" 103 | value = module.eks.oidc_provider 104 | } 105 | 106 | output "oidc_provider_arn" { 107 | description = "The ARN of the OIDC Provider if `enable_irsa = true`" 108 | value = module.eks.oidc_provider_arn 109 | } 110 | 111 | output "cluster_tls_certificate_sha1_fingerprint" { 112 | description = "The SHA1 fingerprint of the public key of the cluster's certificate" 113 | value = module.eks.cluster_tls_certificate_sha1_fingerprint 114 | } 115 | 116 | ################################################################################ 117 | # IAM Role 118 | ################################################################################ 119 | 120 | output "cluster_iam_role_name" { 121 | description = "IAM role name of the EKS cluster" 122 | value = module.eks.cluster_iam_role_name 123 | } 124 | 125 | output "cluster_iam_role_arn" { 126 | description = "IAM role ARN of the EKS cluster" 127 | value = module.eks.cluster_iam_role_arn 128 | } 129 | 130 | output "cluster_iam_role_unique_id" { 131 | description = "Stable and unique string identifying the IAM role" 132 | value = module.eks.cluster_iam_role_unique_id 133 | } 134 | 135 | ################################################################################ 136 | # EKS Addons 137 | ################################################################################ 138 | 139 | output "cluster_addons" { 140 | description = "Map of attribute maps for all EKS cluster addons enabled" 141 | value = module.eks.cluster_addons 142 | } 143 | 144 | ################################################################################ 145 | # EKS Identity Provider 146 | ################################################################################ 147 | 148 | output "cluster_identity_providers" { 149 | description = "Map of attribute maps for all EKS identity providers enabled" 150 | value = module.eks.cluster_identity_providers 151 | } 152 | 153 | ################################################################################ 154 | # CloudWatch Log Group 155 | ################################################################################ 156 | 157 | output "cloudwatch_log_group_name" { 158 | description = "Name of cloudwatch log group created" 159 | value = module.eks.cloudwatch_log_group_name 160 | } 161 | 162 | output "cloudwatch_log_group_arn" { 163 | description = "Arn of cloudwatch log group created" 164 | value = module.eks.cloudwatch_log_group_arn 165 | } 166 | 167 | ################################################################################ 168 | # Fargate Profile 169 | ################################################################################ 170 | 171 | output "fargate_profiles" { 172 | description = "Map of attribute maps for all EKS Fargate Profiles created" 173 | value = module.eks.fargate_profiles 174 | } 175 | 176 | ################################################################################ 177 | # EKS Managed Node Group 178 | ################################################################################ 179 | 180 | output "eks_managed_node_groups" { 181 | description = "Map of attribute maps for all EKS managed node groups created" 182 | value = module.eks.eks_managed_node_groups 183 | } 184 | 185 | output "eks_managed_node_groups_autoscaling_group_names" { 186 | description = "List of the autoscaling group names created by EKS managed node groups" 187 | value = module.eks.eks_managed_node_groups_autoscaling_group_names 188 | } 189 | 190 | ################################################################################ 191 | # Self Managed Node Group 192 | ################################################################################ 193 | 194 | output "self_managed_node_groups" { 195 | description = "Map of attribute maps for all self managed node groups created" 196 | value = module.eks.self_managed_node_groups 197 | } 198 | 199 | output "self_managed_node_groups_autoscaling_group_names" { 200 | description = "List of the autoscaling group names created by self-managed node groups" 201 | value = module.eks.self_managed_node_groups_autoscaling_group_names 202 | } 203 | 204 | ################################################################################ 205 | # Additional 206 | ################################################################################ 207 | 208 | output "aws_auth_configmap_yaml" { 209 | description = "Formatted yaml output for base aws-auth configmap containing roles used in cluster node groups/fargate profiles" 210 | value = module.eks.aws_auth_configmap_yaml 211 | } 212 | -------------------------------------------------------------------------------- /docs/eks/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 9 | | [kubernetes](#requirement\_kubernetes) | >= 2.23 | 10 | 11 | ## Providers 12 | 13 | | Name | Version | 14 | |------|---------| 15 | | [aws](#provider\_aws) | >= 5.20 | 16 | | [aws.virginia](#provider\_aws.virginia) | >= 5.20 | 17 | | [helm](#provider\_helm) | >= 2.11 | 18 | | [kubectl](#provider\_kubectl) | >= 1.14 | 19 | 20 | ## Modules 21 | 22 | | Name | Source | Version | 23 | |------|--------|---------| 24 | | [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 19.16 | 25 | | [karpenter](#module\_karpenter) | terraform-aws-modules/eks/aws//modules/karpenter | n/a | 26 | 27 | ## Resources 28 | 29 | | Name | Type | 30 | |------|------| 31 | | [helm_release.karpenter](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 32 | | [kubectl_manifest.karpenter_example_deployment](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 33 | | [kubectl_manifest.karpenter_node_template](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 34 | | [kubectl_manifest.karpenter_provisioner](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 35 | | [aws_default_tags.tags](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source | 36 | | [aws_ecrpublic_authorization_token.token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecrpublic_authorization_token) | data source | 37 | 38 | ## Inputs 39 | 40 | | Name | Description | Type | Default | Required | 41 | |------|-------------|------|---------|:--------:| 42 | | [auth\_roles](#input\_auth\_roles) | (Optional) Auth Map Roles to be created on EKS | `list` | `[]` | no | 43 | | [auth\_users](#input\_auth\_users) | (Optional) Auth Map Users to be created on EKS | `list` | `[]` | no | 44 | | [azs](#input\_azs) | The list of AZ to use | `list` | n/a | yes | 45 | | [cluster\_endpoint\_public\_access](#input\_cluster\_endpoint\_public\_access) | (Optional) Cluster Endpoint with public access | `bool` | `false` | no | 46 | | [karpenter\_helm\_chart\_version](#input\_karpenter\_helm\_chart\_version) | Karpenter Helm chart version. | `string` | `"v0.31.1"` | no | 47 | | [kubernetes\_version](#input\_kubernetes\_version) | Kubernetes Version | `string` | n/a | yes | 48 | | [private\_subnets](#input\_private\_subnets) | List of private Subnets | `list(string)` | n/a | yes | 49 | | [tfname](#input\_tfname) | Tf Name. local.name value | `string` | n/a | yes | 50 | | [vpc\_id](#input\_vpc\_id) | VPC ID | `string` | n/a | yes | 51 | 52 | ## Outputs 53 | 54 | | Name | Description | 55 | |------|-------------| 56 | | [aws\_auth\_configmap\_yaml](#output\_aws\_auth\_configmap\_yaml) | Formatted yaml output for base aws-auth configmap containing roles used in cluster node groups/fargate profiles | 57 | | [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | 58 | | [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | 59 | | [cluster\_addons](#output\_cluster\_addons) | Map of attribute maps for all EKS cluster addons enabled | 60 | | [cluster\_arn](#output\_cluster\_arn) | The Amazon Resource Name (ARN) of the cluster | 61 | | [cluster\_certificate\_authority\_data](#output\_cluster\_certificate\_authority\_data) | Base64 encoded certificate data required to communicate with the cluster | 62 | | [cluster\_endpoint](#output\_cluster\_endpoint) | Endpoint for your Kubernetes API server | 63 | | [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster | 64 | | [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster | 65 | | [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role | 66 | | [cluster\_id](#output\_cluster\_id) | The ID of the EKS cluster. Note: currently a value is returned only for local EKS clusters created on Outposts | 67 | | [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled | 68 | | [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster | 69 | | [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider | 70 | | [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster | 71 | | [cluster\_primary\_security\_group\_id](#output\_cluster\_primary\_security\_group\_id) | Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console | 72 | | [cluster\_security\_group\_arn](#output\_cluster\_security\_group\_arn) | Amazon Resource Name (ARN) of the cluster security group | 73 | | [cluster\_security\_group\_id](#output\_cluster\_security\_group\_id) | ID of the cluster security group | 74 | | [cluster\_status](#output\_cluster\_status) | Status of the EKS cluster. One of `CREATING`, `ACTIVE`, `DELETING`, `FAILED` | 75 | | [cluster\_tls\_certificate\_sha1\_fingerprint](#output\_cluster\_tls\_certificate\_sha1\_fingerprint) | The SHA1 fingerprint of the public key of the cluster's certificate | 76 | | [eks\_managed\_node\_groups](#output\_eks\_managed\_node\_groups) | Map of attribute maps for all EKS managed node groups created | 77 | | [eks\_managed\_node\_groups\_autoscaling\_group\_names](#output\_eks\_managed\_node\_groups\_autoscaling\_group\_names) | List of the autoscaling group names created by EKS managed node groups | 78 | | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | 79 | | [helm\_karpenter\_namespace](#output\_helm\_karpenter\_namespace) | n/a | 80 | | [helm\_karpenter\_version](#output\_helm\_karpenter\_version) | n/a | 81 | | [karpenter-irsa-arn](#output\_karpenter-irsa-arn) | n/a | 82 | | [kms\_key\_arn](#output\_kms\_key\_arn) | The Amazon Resource Name (ARN) of the key | 83 | | [kms\_key\_id](#output\_kms\_key\_id) | The globally unique identifier for the key | 84 | | [kms\_key\_policy](#output\_kms\_key\_policy) | The IAM resource policy set on the key | 85 | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | 86 | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | 87 | | [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | 88 | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | 89 | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | 90 | | [self\_managed\_node\_groups\_autoscaling\_group\_names](#output\_self\_managed\_node\_groups\_autoscaling\_group\_names) | List of the autoscaling group names created by self-managed node groups | 91 | -------------------------------------------------------------------------------- /modules/eks/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | | [helm](#requirement\_helm) | >= 2.11 | 8 | | [kubectl](#requirement\_kubectl) | >= 1.14 | 9 | | [kubernetes](#requirement\_kubernetes) | >= 2.23 | 10 | 11 | ## Providers 12 | 13 | | Name | Version | 14 | |------|---------| 15 | | [aws](#provider\_aws) | >= 5.20 | 16 | | [aws.virginia](#provider\_aws.virginia) | >= 5.20 | 17 | | [helm](#provider\_helm) | >= 2.11 | 18 | | [kubectl](#provider\_kubectl) | >= 1.14 | 19 | 20 | ## Modules 21 | 22 | | Name | Source | Version | 23 | |------|--------|---------| 24 | | [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 19.16 | 25 | | [karpenter](#module\_karpenter) | terraform-aws-modules/eks/aws//modules/karpenter | n/a | 26 | 27 | ## Resources 28 | 29 | | Name | Type | 30 | |------|------| 31 | | [helm_release.karpenter](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | 32 | | [kubectl_manifest.karpenter_example_deployment](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 33 | | [kubectl_manifest.karpenter_node_template](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 34 | | [kubectl_manifest.karpenter_provisioner](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | 35 | | [aws_default_tags.tags](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source | 36 | | [aws_ecrpublic_authorization_token.token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecrpublic_authorization_token) | data source | 37 | 38 | ## Inputs 39 | 40 | | Name | Description | Type | Default | Required | 41 | |------|-------------|------|---------|:--------:| 42 | | [auth\_roles](#input\_auth\_roles) | (Optional) Auth Map Roles to be created on EKS | `list` | `[]` | no | 43 | | [auth\_users](#input\_auth\_users) | (Optional) Auth Map Users to be created on EKS | `list` | `[]` | no | 44 | | [azs](#input\_azs) | The list of AZ to use | `list` | n/a | yes | 45 | | [cluster\_endpoint\_public\_access](#input\_cluster\_endpoint\_public\_access) | (Optional) Cluster Endpoint with public access | `bool` | `false` | no | 46 | | [karpenter\_helm\_chart\_version](#input\_karpenter\_helm\_chart\_version) | Karpenter Helm chart version. | `string` | `"v0.31.1"` | no | 47 | | [kubernetes\_version](#input\_kubernetes\_version) | Kubernetes Version | `string` | n/a | yes | 48 | | [private\_subnets](#input\_private\_subnets) | List of private Subnets | `list(string)` | n/a | yes | 49 | | [tfname](#input\_tfname) | Tf Name. local.name value | `string` | n/a | yes | 50 | | [vpc\_id](#input\_vpc\_id) | VPC ID | `string` | n/a | yes | 51 | 52 | ## Outputs 53 | 54 | | Name | Description | 55 | |------|-------------| 56 | | [aws\_auth\_configmap\_yaml](#output\_aws\_auth\_configmap\_yaml) | Formatted yaml output for base aws-auth configmap containing roles used in cluster node groups/fargate profiles | 57 | | [cloudwatch\_log\_group\_arn](#output\_cloudwatch\_log\_group\_arn) | Arn of cloudwatch log group created | 58 | | [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of cloudwatch log group created | 59 | | [cluster\_addons](#output\_cluster\_addons) | Map of attribute maps for all EKS cluster addons enabled | 60 | | [cluster\_arn](#output\_cluster\_arn) | The Amazon Resource Name (ARN) of the cluster | 61 | | [cluster\_certificate\_authority\_data](#output\_cluster\_certificate\_authority\_data) | Base64 encoded certificate data required to communicate with the cluster | 62 | | [cluster\_endpoint](#output\_cluster\_endpoint) | Endpoint for your Kubernetes API server | 63 | | [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster | 64 | | [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster | 65 | | [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role | 66 | | [cluster\_id](#output\_cluster\_id) | The ID of the EKS cluster. Note: currently a value is returned only for local EKS clusters created on Outposts | 67 | | [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled | 68 | | [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster | 69 | | [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider | 70 | | [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster | 71 | | [cluster\_primary\_security\_group\_id](#output\_cluster\_primary\_security\_group\_id) | Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console | 72 | | [cluster\_security\_group\_arn](#output\_cluster\_security\_group\_arn) | Amazon Resource Name (ARN) of the cluster security group | 73 | | [cluster\_security\_group\_id](#output\_cluster\_security\_group\_id) | ID of the cluster security group | 74 | | [cluster\_status](#output\_cluster\_status) | Status of the EKS cluster. One of `CREATING`, `ACTIVE`, `DELETING`, `FAILED` | 75 | | [cluster\_tls\_certificate\_sha1\_fingerprint](#output\_cluster\_tls\_certificate\_sha1\_fingerprint) | The SHA1 fingerprint of the public key of the cluster's certificate | 76 | | [eks\_managed\_node\_groups](#output\_eks\_managed\_node\_groups) | Map of attribute maps for all EKS managed node groups created | 77 | | [eks\_managed\_node\_groups\_autoscaling\_group\_names](#output\_eks\_managed\_node\_groups\_autoscaling\_group\_names) | List of the autoscaling group names created by EKS managed node groups | 78 | | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | 79 | | [helm\_karpenter\_namespace](#output\_helm\_karpenter\_namespace) | n/a | 80 | | [helm\_karpenter\_version](#output\_helm\_karpenter\_version) | n/a | 81 | | [karpenter-irsa-arn](#output\_karpenter-irsa-arn) | n/a | 82 | | [kms\_key\_arn](#output\_kms\_key\_arn) | The Amazon Resource Name (ARN) of the key | 83 | | [kms\_key\_id](#output\_kms\_key\_id) | The globally unique identifier for the key | 84 | | [kms\_key\_policy](#output\_kms\_key\_policy) | The IAM resource policy set on the key | 85 | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | 86 | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | 87 | | [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | 88 | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | 89 | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | 90 | | [self\_managed\_node\_groups\_autoscaling\_group\_names](#output\_self\_managed\_node\_groups\_autoscaling\_group\_names) | List of the autoscaling group names created by self-managed node groups | 91 | -------------------------------------------------------------------------------- /modules/vpc/outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_id" { 2 | description = "The ID of the VPC" 3 | value = module.vpc.vpc_id 4 | } 5 | 6 | output "vpc_arn" { 7 | description = "The ARN of the VPC" 8 | value = module.vpc.vpc_arn 9 | } 10 | 11 | output "vpc_cidr_block" { 12 | description = "The CIDR block of the VPC" 13 | value = module.vpc.vpc_cidr_block 14 | } 15 | 16 | output "vpc_instance_tenancy" { 17 | description = "Tenancy of instances spin up within VPC" 18 | value = module.vpc.vpc_instance_tenancy 19 | } 20 | 21 | output "vpc_enable_dns_support" { 22 | description = "Whether or not the VPC has DNS support" 23 | value = module.vpc.vpc_enable_dns_support 24 | } 25 | 26 | output "vpc_enable_dns_hostnames" { 27 | description = "Whether or not the VPC has DNS hostname support" 28 | value = module.vpc.vpc_enable_dns_hostnames 29 | } 30 | 31 | output "vpc_main_route_table_id" { 32 | description = "The ID of the main route table associated with this VPC" 33 | value = module.vpc.vpc_main_route_table_id 34 | } 35 | 36 | output "vpc_ipv6_association_id" { 37 | description = "The association ID for the IPv6 CIDR block" 38 | value = module.vpc.vpc_ipv6_association_id 39 | } 40 | 41 | output "vpc_ipv6_cidr_block" { 42 | description = "The IPv6 CIDR block" 43 | value = module.vpc.vpc_ipv6_cidr_block 44 | } 45 | 46 | output "vpc_secondary_cidr_blocks" { 47 | description = "List of secondary CIDR blocks of the VPC" 48 | value = module.vpc.vpc_secondary_cidr_blocks 49 | } 50 | 51 | output "vpc_owner_id" { 52 | description = "The ID of the AWS account that owns the VPC" 53 | value = module.vpc.vpc_owner_id 54 | } 55 | 56 | output "private_subnets" { 57 | description = "List of IDs of private subnets" 58 | value = module.vpc.private_subnets 59 | } 60 | 61 | output "private_subnet_arns" { 62 | description = "List of ARNs of private subnets" 63 | value = module.vpc.private_subnet_arns 64 | } 65 | 66 | output "private_subnets_cidr_blocks" { 67 | description = "List of cidr_blocks of private subnets" 68 | value = module.vpc.private_subnets_cidr_blocks 69 | } 70 | 71 | output "private_subnets_ipv6_cidr_blocks" { 72 | description = "List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC" 73 | value = module.vpc.private_subnets_ipv6_cidr_blocks 74 | } 75 | 76 | output "public_subnets" { 77 | description = "List of IDs of public subnets" 78 | value = module.vpc.public_subnets 79 | } 80 | 81 | output "public_subnet_arns" { 82 | description = "List of ARNs of public subnets" 83 | value = module.vpc.public_subnet_arns 84 | } 85 | 86 | output "public_subnets_cidr_blocks" { 87 | description = "List of cidr_blocks of public subnets" 88 | value = module.vpc.public_subnets_cidr_blocks 89 | } 90 | 91 | output "public_subnets_ipv6_cidr_blocks" { 92 | description = "List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC" 93 | value = module.vpc.public_subnets_ipv6_cidr_blocks 94 | } 95 | 96 | output "database_subnets" { 97 | description = "List of IDs of database subnets" 98 | value = module.vpc.database_subnets 99 | } 100 | 101 | output "database_subnet_arns" { 102 | description = "List of ARNs of database subnets" 103 | value = module.vpc.database_subnet_arns 104 | } 105 | 106 | output "database_subnets_cidr_blocks" { 107 | description = "List of cidr_blocks of database subnets" 108 | value = module.vpc.database_subnets_cidr_blocks 109 | } 110 | 111 | output "database_subnets_ipv6_cidr_blocks" { 112 | description = "List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC" 113 | value = module.vpc.database_subnets_ipv6_cidr_blocks 114 | } 115 | 116 | output "database_subnet_group" { 117 | description = "ID of database subnet group" 118 | value = module.vpc.database_subnet_group 119 | } 120 | 121 | output "database_subnet_group_name" { 122 | description = "Name of database subnet group" 123 | value = module.vpc.database_subnet_group_name 124 | } 125 | 126 | output "public_route_table_ids" { 127 | description = "List of IDs of public route tables" 128 | value = module.vpc.public_route_table_ids 129 | } 130 | 131 | output "private_route_table_ids" { 132 | description = "List of IDs of private route tables" 133 | value = module.vpc.private_route_table_ids 134 | } 135 | 136 | output "database_route_table_ids" { 137 | description = "List of IDs of database route tables" 138 | value = module.vpc.database_route_table_ids 139 | } 140 | 141 | output "public_internet_gateway_route_id" { 142 | description = "ID of the internet gateway route" 143 | value = module.vpc.public_internet_gateway_route_id 144 | } 145 | 146 | output "public_internet_gateway_ipv6_route_id" { 147 | description = "ID of the IPv6 internet gateway route" 148 | value = module.vpc.public_internet_gateway_ipv6_route_id 149 | } 150 | 151 | output "database_internet_gateway_route_id" { 152 | description = "ID of the database internet gateway route" 153 | value = module.vpc.database_internet_gateway_route_id 154 | } 155 | 156 | output "database_nat_gateway_route_ids" { 157 | description = "List of IDs of the database nat gateway route" 158 | value = module.vpc.database_nat_gateway_route_ids 159 | } 160 | 161 | output "database_ipv6_egress_route_id" { 162 | description = "ID of the database IPv6 egress route" 163 | value = module.vpc.database_ipv6_egress_route_id 164 | } 165 | 166 | output "private_nat_gateway_route_ids" { 167 | description = "List of IDs of the private nat gateway route" 168 | value = module.vpc.private_nat_gateway_route_ids 169 | } 170 | 171 | output "private_ipv6_egress_route_ids" { 172 | description = "List of IDs of the ipv6 egress route" 173 | value = module.vpc.private_ipv6_egress_route_ids 174 | } 175 | 176 | output "private_route_table_association_ids" { 177 | description = "List of IDs of the private route table association" 178 | value = module.vpc.private_route_table_association_ids 179 | } 180 | 181 | output "database_route_table_association_ids" { 182 | description = "List of IDs of the database route table association" 183 | value = module.vpc.database_route_table_association_ids 184 | } 185 | 186 | output "public_route_table_association_ids" { 187 | description = "List of IDs of the public route table association" 188 | value = module.vpc.public_route_table_association_ids 189 | } 190 | 191 | output "dhcp_options_id" { 192 | description = "The ID of the DHCP options" 193 | value = module.vpc.dhcp_options_id 194 | } 195 | 196 | output "nat_ids" { 197 | description = "List of allocation ID of Elastic IPs created for AWS NAT Gateway" 198 | value = module.vpc.nat_ids 199 | } 200 | 201 | output "nat_public_ips" { 202 | description = "List of public Elastic IPs created for AWS NAT Gateway" 203 | value = module.vpc.nat_public_ips 204 | } 205 | 206 | output "natgw_ids" { 207 | description = "List of NAT Gateway IDs" 208 | value = module.vpc.natgw_ids 209 | } 210 | 211 | output "igw_id" { 212 | description = "The ID of the Internet Gateway" 213 | value = module.vpc.igw_id 214 | } 215 | 216 | output "igw_arn" { 217 | description = "The ARN of the Internet Gateway" 218 | value = module.vpc.igw_arn 219 | } 220 | 221 | output "egress_only_internet_gateway_id" { 222 | description = "The ID of the egress only Internet Gateway" 223 | value = module.vpc.egress_only_internet_gateway_id 224 | } 225 | 226 | output "cgw_ids" { 227 | description = "List of IDs of Customer Gateway" 228 | value = module.vpc.cgw_ids 229 | } 230 | 231 | output "cgw_arns" { 232 | description = "List of ARNs of Customer Gateway" 233 | value = module.vpc.cgw_arns 234 | } 235 | 236 | output "this_customer_gateway" { 237 | description = "Map of Customer Gateway attributes" 238 | value = module.vpc.this_customer_gateway 239 | } 240 | 241 | output "vgw_id" { 242 | description = "The ID of the VPN Gateway" 243 | value = module.vpc.vgw_id 244 | } 245 | 246 | output "vgw_arn" { 247 | description = "The ARN of the VPN Gateway" 248 | value = module.vpc.vgw_arn 249 | } 250 | 251 | output "public_network_acl_id" { 252 | description = "ID of the public network ACL" 253 | value = module.vpc.public_network_acl_id 254 | } 255 | 256 | output "public_network_acl_arn" { 257 | description = "ARN of the public network ACL" 258 | value = module.vpc.public_network_acl_arn 259 | } 260 | 261 | output "private_network_acl_id" { 262 | description = "ID of the private network ACL" 263 | value = module.vpc.private_network_acl_id 264 | } 265 | 266 | output "private_network_acl_arn" { 267 | description = "ARN of the private network ACL" 268 | value = module.vpc.private_network_acl_arn 269 | } 270 | 271 | output "database_network_acl_id" { 272 | description = "ID of the database network ACL" 273 | value = module.vpc.database_network_acl_id 274 | } 275 | 276 | output "database_network_acl_arn" { 277 | description = "ARN of the database network ACL" 278 | value = module.vpc.database_network_acl_arn 279 | } 280 | 281 | # VPC flow log 282 | output "vpc_flow_log_id" { 283 | description = "The ID of the Flow Log resource" 284 | value = module.vpc.vpc_flow_log_id 285 | } 286 | 287 | output "vpc_flow_log_destination_arn" { 288 | description = "The ARN of the destination for VPC Flow Logs" 289 | value = module.vpc.vpc_flow_log_destination_arn 290 | } 291 | 292 | output "vpc_flow_log_destination_type" { 293 | description = "The type of the destination for VPC Flow Logs" 294 | value = module.vpc.vpc_flow_log_destination_type 295 | } 296 | 297 | output "vpc_flow_log_cloudwatch_iam_role_arn" { 298 | description = "The ARN of the IAM role used when pushing logs to Cloudwatch log group" 299 | value = module.vpc.vpc_flow_log_cloudwatch_iam_role_arn 300 | } 301 | 302 | # # VPC endpoints 303 | # output "vpc_endpoints" { 304 | # description = "Array containing the full resource object and attributes for all endpoints created" 305 | # value = module.vpc_endpoints.endpoints 306 | # } 307 | 308 | # output "vpc_endpoints_security_group_arn" { 309 | # description = "Amazon Resource Name (ARN) of the security group" 310 | # value = module.vpc_endpoints.security_group_arn 311 | # } 312 | 313 | # output "vpc_endpoints_security_group_id" { 314 | # description = "ID of the security group" 315 | # value = module.vpc_endpoints.security_group_id 316 | # } 317 | 318 | output "eip_id" { 319 | description = "List of Elastic IP generated for Nat Gateway" 320 | value = aws_eip.nat.*.id 321 | } -------------------------------------------------------------------------------- /docs/vpc/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | 8 | ## Providers 9 | 10 | | Name | Version | 11 | |------|---------| 12 | | [aws](#provider\_aws) | >= 5.20 | 13 | 14 | ## Modules 15 | 16 | | Name | Source | Version | 17 | |------|--------|---------| 18 | | [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 | 19 | 20 | ## Resources 21 | 22 | | Name | Type | 23 | |------|------| 24 | | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource | 25 | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | 26 | | [aws_default_tags.tags](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source | 27 | 28 | ## Inputs 29 | 30 | | Name | Description | Type | Default | Required | 31 | |------|-------------|------|---------|:--------:| 32 | | [azs](#input\_azs) | The list of AZ to use | `list` | n/a | yes | 33 | | [cidr](#input\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `"10.0.0.0/16"` | no | 34 | | [create\_nat\_gateway](#input\_create\_nat\_gateway) | Create the Nat gateway? | `bool` | `false` | no | 35 | | [create\_subnet\_data](#input\_create\_subnet\_data) | Create the data subnet? | `bool` | `true` | no | 36 | | [create\_subnet\_private](#input\_create\_subnet\_private) | Create the private subnet? | `bool` | `true` | no | 37 | | [create\_subnet\_public](#input\_create\_subnet\_public) | Create the public subnet? | `bool` | `true` | no | 38 | | [enable\_flow\_log](#input\_enable\_flow\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no | 39 | | [ipv6\_cidr](#input\_ipv6\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no | 40 | | [one\_nat\_gateway\_per\_az](#input\_one\_nat\_gateway\_per\_az) | One Nat per AZ? | `bool` | `true` | no | 41 | | [tfname](#input\_tfname) | Tf Name. local.name value | `string` | n/a | yes | 42 | 43 | ## Outputs 44 | 45 | | Name | Description | 46 | |------|-------------| 47 | | [cgw\_arns](#output\_cgw\_arns) | List of ARNs of Customer Gateway | 48 | | [cgw\_ids](#output\_cgw\_ids) | List of IDs of Customer Gateway | 49 | | [database\_internet\_gateway\_route\_id](#output\_database\_internet\_gateway\_route\_id) | ID of the database internet gateway route | 50 | | [database\_ipv6\_egress\_route\_id](#output\_database\_ipv6\_egress\_route\_id) | ID of the database IPv6 egress route | 51 | | [database\_nat\_gateway\_route\_ids](#output\_database\_nat\_gateway\_route\_ids) | List of IDs of the database nat gateway route | 52 | | [database\_network\_acl\_arn](#output\_database\_network\_acl\_arn) | ARN of the database network ACL | 53 | | [database\_network\_acl\_id](#output\_database\_network\_acl\_id) | ID of the database network ACL | 54 | | [database\_route\_table\_association\_ids](#output\_database\_route\_table\_association\_ids) | List of IDs of the database route table association | 55 | | [database\_route\_table\_ids](#output\_database\_route\_table\_ids) | List of IDs of database route tables | 56 | | [database\_subnet\_arns](#output\_database\_subnet\_arns) | List of ARNs of database subnets | 57 | | [database\_subnet\_group](#output\_database\_subnet\_group) | ID of database subnet group | 58 | | [database\_subnet\_group\_name](#output\_database\_subnet\_group\_name) | Name of database subnet group | 59 | | [database\_subnets](#output\_database\_subnets) | List of IDs of database subnets | 60 | | [database\_subnets\_cidr\_blocks](#output\_database\_subnets\_cidr\_blocks) | List of cidr\_blocks of database subnets | 61 | | [database\_subnets\_ipv6\_cidr\_blocks](#output\_database\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of database subnets in an IPv6 enabled VPC | 62 | | [dhcp\_options\_id](#output\_dhcp\_options\_id) | The ID of the DHCP options | 63 | | [egress\_only\_internet\_gateway\_id](#output\_egress\_only\_internet\_gateway\_id) | The ID of the egress only Internet Gateway | 64 | | [eip\_id](#output\_eip\_id) | List of Elastic IP generated for Nat Gateway | 65 | | [igw\_arn](#output\_igw\_arn) | The ARN of the Internet Gateway | 66 | | [igw\_id](#output\_igw\_id) | The ID of the Internet Gateway | 67 | | [nat\_ids](#output\_nat\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway | 68 | | [nat\_public\_ips](#output\_nat\_public\_ips) | List of public Elastic IPs created for AWS NAT Gateway | 69 | | [natgw\_ids](#output\_natgw\_ids) | List of NAT Gateway IDs | 70 | | [private\_ipv6\_egress\_route\_ids](#output\_private\_ipv6\_egress\_route\_ids) | List of IDs of the ipv6 egress route | 71 | | [private\_nat\_gateway\_route\_ids](#output\_private\_nat\_gateway\_route\_ids) | List of IDs of the private nat gateway route | 72 | | [private\_network\_acl\_arn](#output\_private\_network\_acl\_arn) | ARN of the private network ACL | 73 | | [private\_network\_acl\_id](#output\_private\_network\_acl\_id) | ID of the private network ACL | 74 | | [private\_route\_table\_association\_ids](#output\_private\_route\_table\_association\_ids) | List of IDs of the private route table association | 75 | | [private\_route\_table\_ids](#output\_private\_route\_table\_ids) | List of IDs of private route tables | 76 | | [private\_subnet\_arns](#output\_private\_subnet\_arns) | List of ARNs of private subnets | 77 | | [private\_subnets](#output\_private\_subnets) | List of IDs of private subnets | 78 | | [private\_subnets\_cidr\_blocks](#output\_private\_subnets\_cidr\_blocks) | List of cidr\_blocks of private subnets | 79 | | [private\_subnets\_ipv6\_cidr\_blocks](#output\_private\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of private subnets in an IPv6 enabled VPC | 80 | | [public\_internet\_gateway\_ipv6\_route\_id](#output\_public\_internet\_gateway\_ipv6\_route\_id) | ID of the IPv6 internet gateway route | 81 | | [public\_internet\_gateway\_route\_id](#output\_public\_internet\_gateway\_route\_id) | ID of the internet gateway route | 82 | | [public\_network\_acl\_arn](#output\_public\_network\_acl\_arn) | ARN of the public network ACL | 83 | | [public\_network\_acl\_id](#output\_public\_network\_acl\_id) | ID of the public network ACL | 84 | | [public\_route\_table\_association\_ids](#output\_public\_route\_table\_association\_ids) | List of IDs of the public route table association | 85 | | [public\_route\_table\_ids](#output\_public\_route\_table\_ids) | List of IDs of public route tables | 86 | | [public\_subnet\_arns](#output\_public\_subnet\_arns) | List of ARNs of public subnets | 87 | | [public\_subnets](#output\_public\_subnets) | List of IDs of public subnets | 88 | | [public\_subnets\_cidr\_blocks](#output\_public\_subnets\_cidr\_blocks) | List of cidr\_blocks of public subnets | 89 | | [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC | 90 | | [this\_customer\_gateway](#output\_this\_customer\_gateway) | Map of Customer Gateway attributes | 91 | | [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway | 92 | | [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway | 93 | | [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC | 94 | | [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC | 95 | | [vpc\_enable\_dns\_hostnames](#output\_vpc\_enable\_dns\_hostnames) | Whether or not the VPC has DNS hostname support | 96 | | [vpc\_enable\_dns\_support](#output\_vpc\_enable\_dns\_support) | Whether or not the VPC has DNS support | 97 | | [vpc\_flow\_log\_cloudwatch\_iam\_role\_arn](#output\_vpc\_flow\_log\_cloudwatch\_iam\_role\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group | 98 | | [vpc\_flow\_log\_destination\_arn](#output\_vpc\_flow\_log\_destination\_arn) | The ARN of the destination for VPC Flow Logs | 99 | | [vpc\_flow\_log\_destination\_type](#output\_vpc\_flow\_log\_destination\_type) | The type of the destination for VPC Flow Logs | 100 | | [vpc\_flow\_log\_id](#output\_vpc\_flow\_log\_id) | The ID of the Flow Log resource | 101 | | [vpc\_id](#output\_vpc\_id) | The ID of the VPC | 102 | | [vpc\_instance\_tenancy](#output\_vpc\_instance\_tenancy) | Tenancy of instances spin up within VPC | 103 | | [vpc\_ipv6\_association\_id](#output\_vpc\_ipv6\_association\_id) | The association ID for the IPv6 CIDR block | 104 | | [vpc\_ipv6\_cidr\_block](#output\_vpc\_ipv6\_cidr\_block) | The IPv6 CIDR block | 105 | | [vpc\_main\_route\_table\_id](#output\_vpc\_main\_route\_table\_id) | The ID of the main route table associated with this VPC | 106 | | [vpc\_owner\_id](#output\_vpc\_owner\_id) | The ID of the AWS account that owns the VPC | 107 | | [vpc\_secondary\_cidr\_blocks](#output\_vpc\_secondary\_cidr\_blocks) | List of secondary CIDR blocks of the VPC | 108 | -------------------------------------------------------------------------------- /modules/vpc/README.md: -------------------------------------------------------------------------------- 1 | ## Requirements 2 | 3 | | Name | Version | 4 | |------|---------| 5 | | [terraform](#requirement\_terraform) | >= 1.0 | 6 | | [aws](#requirement\_aws) | >= 5.20 | 7 | 8 | ## Providers 9 | 10 | | Name | Version | 11 | |------|---------| 12 | | [aws](#provider\_aws) | >= 5.20 | 13 | 14 | ## Modules 15 | 16 | | Name | Source | Version | 17 | |------|--------|---------| 18 | | [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 | 19 | 20 | ## Resources 21 | 22 | | Name | Type | 23 | |------|------| 24 | | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource | 25 | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | 26 | | [aws_default_tags.tags](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source | 27 | 28 | ## Inputs 29 | 30 | | Name | Description | Type | Default | Required | 31 | |------|-------------|------|---------|:--------:| 32 | | [azs](#input\_azs) | The list of AZ to use | `list` | n/a | yes | 33 | | [cidr](#input\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `"10.0.0.0/16"` | no | 34 | | [create\_nat\_gateway](#input\_create\_nat\_gateway) | Create the Nat gateway? | `bool` | `false` | no | 35 | | [create\_subnet\_data](#input\_create\_subnet\_data) | Create the data subnet? | `bool` | `true` | no | 36 | | [create\_subnet\_private](#input\_create\_subnet\_private) | Create the private subnet? | `bool` | `true` | no | 37 | | [create\_subnet\_public](#input\_create\_subnet\_public) | Create the public subnet? | `bool` | `true` | no | 38 | | [enable\_flow\_log](#input\_enable\_flow\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no | 39 | | [ipv6\_cidr](#input\_ipv6\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no | 40 | | [one\_nat\_gateway\_per\_az](#input\_one\_nat\_gateway\_per\_az) | One Nat per AZ? | `bool` | `true` | no | 41 | | [tfname](#input\_tfname) | Tf Name. local.name value | `string` | n/a | yes | 42 | 43 | ## Outputs 44 | 45 | | Name | Description | 46 | |------|-------------| 47 | | [cgw\_arns](#output\_cgw\_arns) | List of ARNs of Customer Gateway | 48 | | [cgw\_ids](#output\_cgw\_ids) | List of IDs of Customer Gateway | 49 | | [database\_internet\_gateway\_route\_id](#output\_database\_internet\_gateway\_route\_id) | ID of the database internet gateway route | 50 | | [database\_ipv6\_egress\_route\_id](#output\_database\_ipv6\_egress\_route\_id) | ID of the database IPv6 egress route | 51 | | [database\_nat\_gateway\_route\_ids](#output\_database\_nat\_gateway\_route\_ids) | List of IDs of the database nat gateway route | 52 | | [database\_network\_acl\_arn](#output\_database\_network\_acl\_arn) | ARN of the database network ACL | 53 | | [database\_network\_acl\_id](#output\_database\_network\_acl\_id) | ID of the database network ACL | 54 | | [database\_route\_table\_association\_ids](#output\_database\_route\_table\_association\_ids) | List of IDs of the database route table association | 55 | | [database\_route\_table\_ids](#output\_database\_route\_table\_ids) | List of IDs of database route tables | 56 | | [database\_subnet\_arns](#output\_database\_subnet\_arns) | List of ARNs of database subnets | 57 | | [database\_subnet\_group](#output\_database\_subnet\_group) | ID of database subnet group | 58 | | [database\_subnet\_group\_name](#output\_database\_subnet\_group\_name) | Name of database subnet group | 59 | | [database\_subnets](#output\_database\_subnets) | List of IDs of database subnets | 60 | | [database\_subnets\_cidr\_blocks](#output\_database\_subnets\_cidr\_blocks) | List of cidr\_blocks of database subnets | 61 | | [database\_subnets\_ipv6\_cidr\_blocks](#output\_database\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of database subnets in an IPv6 enabled VPC | 62 | | [dhcp\_options\_id](#output\_dhcp\_options\_id) | The ID of the DHCP options | 63 | | [egress\_only\_internet\_gateway\_id](#output\_egress\_only\_internet\_gateway\_id) | The ID of the egress only Internet Gateway | 64 | | [eip\_id](#output\_eip\_id) | List of Elastic IP generated for Nat Gateway | 65 | | [igw\_arn](#output\_igw\_arn) | The ARN of the Internet Gateway | 66 | | [igw\_id](#output\_igw\_id) | The ID of the Internet Gateway | 67 | | [nat\_ids](#output\_nat\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway | 68 | | [nat\_public\_ips](#output\_nat\_public\_ips) | List of public Elastic IPs created for AWS NAT Gateway | 69 | | [natgw\_ids](#output\_natgw\_ids) | List of NAT Gateway IDs | 70 | | [private\_ipv6\_egress\_route\_ids](#output\_private\_ipv6\_egress\_route\_ids) | List of IDs of the ipv6 egress route | 71 | | [private\_nat\_gateway\_route\_ids](#output\_private\_nat\_gateway\_route\_ids) | List of IDs of the private nat gateway route | 72 | | [private\_network\_acl\_arn](#output\_private\_network\_acl\_arn) | ARN of the private network ACL | 73 | | [private\_network\_acl\_id](#output\_private\_network\_acl\_id) | ID of the private network ACL | 74 | | [private\_route\_table\_association\_ids](#output\_private\_route\_table\_association\_ids) | List of IDs of the private route table association | 75 | | [private\_route\_table\_ids](#output\_private\_route\_table\_ids) | List of IDs of private route tables | 76 | | [private\_subnet\_arns](#output\_private\_subnet\_arns) | List of ARNs of private subnets | 77 | | [private\_subnets](#output\_private\_subnets) | List of IDs of private subnets | 78 | | [private\_subnets\_cidr\_blocks](#output\_private\_subnets\_cidr\_blocks) | List of cidr\_blocks of private subnets | 79 | | [private\_subnets\_ipv6\_cidr\_blocks](#output\_private\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of private subnets in an IPv6 enabled VPC | 80 | | [public\_internet\_gateway\_ipv6\_route\_id](#output\_public\_internet\_gateway\_ipv6\_route\_id) | ID of the IPv6 internet gateway route | 81 | | [public\_internet\_gateway\_route\_id](#output\_public\_internet\_gateway\_route\_id) | ID of the internet gateway route | 82 | | [public\_network\_acl\_arn](#output\_public\_network\_acl\_arn) | ARN of the public network ACL | 83 | | [public\_network\_acl\_id](#output\_public\_network\_acl\_id) | ID of the public network ACL | 84 | | [public\_route\_table\_association\_ids](#output\_public\_route\_table\_association\_ids) | List of IDs of the public route table association | 85 | | [public\_route\_table\_ids](#output\_public\_route\_table\_ids) | List of IDs of public route tables | 86 | | [public\_subnet\_arns](#output\_public\_subnet\_arns) | List of ARNs of public subnets | 87 | | [public\_subnets](#output\_public\_subnets) | List of IDs of public subnets | 88 | | [public\_subnets\_cidr\_blocks](#output\_public\_subnets\_cidr\_blocks) | List of cidr\_blocks of public subnets | 89 | | [public\_subnets\_ipv6\_cidr\_blocks](#output\_public\_subnets\_ipv6\_cidr\_blocks) | List of IPv6 cidr\_blocks of public subnets in an IPv6 enabled VPC | 90 | | [this\_customer\_gateway](#output\_this\_customer\_gateway) | Map of Customer Gateway attributes | 91 | | [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway | 92 | | [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway | 93 | | [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC | 94 | | [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC | 95 | | [vpc\_enable\_dns\_hostnames](#output\_vpc\_enable\_dns\_hostnames) | Whether or not the VPC has DNS hostname support | 96 | | [vpc\_enable\_dns\_support](#output\_vpc\_enable\_dns\_support) | Whether or not the VPC has DNS support | 97 | | [vpc\_flow\_log\_cloudwatch\_iam\_role\_arn](#output\_vpc\_flow\_log\_cloudwatch\_iam\_role\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group | 98 | | [vpc\_flow\_log\_destination\_arn](#output\_vpc\_flow\_log\_destination\_arn) | The ARN of the destination for VPC Flow Logs | 99 | | [vpc\_flow\_log\_destination\_type](#output\_vpc\_flow\_log\_destination\_type) | The type of the destination for VPC Flow Logs | 100 | | [vpc\_flow\_log\_id](#output\_vpc\_flow\_log\_id) | The ID of the Flow Log resource | 101 | | [vpc\_id](#output\_vpc\_id) | The ID of the VPC | 102 | | [vpc\_instance\_tenancy](#output\_vpc\_instance\_tenancy) | Tenancy of instances spin up within VPC | 103 | | [vpc\_ipv6\_association\_id](#output\_vpc\_ipv6\_association\_id) | The association ID for the IPv6 CIDR block | 104 | | [vpc\_ipv6\_cidr\_block](#output\_vpc\_ipv6\_cidr\_block) | The IPv6 CIDR block | 105 | | [vpc\_main\_route\_table\_id](#output\_vpc\_main\_route\_table\_id) | The ID of the main route table associated with this VPC | 106 | | [vpc\_owner\_id](#output\_vpc\_owner\_id) | The ID of the AWS account that owns the VPC | 107 | | [vpc\_secondary\_cidr\_blocks](#output\_vpc\_secondary\_cidr\_blocks) | List of secondary CIDR blocks of the VPC | 108 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------