[![README Header][readme_header_img]][readme_header_link]
[![Cloud Posse][logo]](https://cpco.io/homepage)
# terraform-aws-eks-fargate-profile [](https://g.codefresh.io/public/accounts/cloudposse/pipelines/5deeced5158ef2a8061fe466) [](https://github.com/cloudposse/terraform-aws-eks-fargate-profile/releases/latest) [](https://slack.cloudposse.com)
Terraform module to provision an EKS Node Group for [Elastic Container Service for Kubernetes](https://aws.amazon.com/eks/).
Instantiate it multiple times to create many EKS node groups with specific settings such as GPUs, EC2 instance types, or autoscale parameters.
---
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
[
][share_email]
[
][share_googleplus]
[
][share_facebook]
[
][share_reddit]
[
][share_linkedin]
[
][share_twitter]
[][terraform_modules]
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!
## Introduction
## Usage
**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases.
Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-eks-fargate-profile/releases).
For a complete example, see [examples/complete](examples/complete).
For automated tests of the complete example using [bats](https://github.com/bats-core/bats-core) and [Terratest](https://github.com/gruntwork-io/terratest) (which tests and deploys the example on AWS), see [test](test).
```hcl
provider "aws" {
region = var.region
}
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
namespace = var.namespace
name = var.name
stage = var.stage
delimiter = var.delimiter
attributes = compact(concat(var.attributes, list("cluster")))
tags = var.tags
}
locals {
tags = merge(module.label.tags, map("kubernetes.io/cluster/${module.label.id}", "shared"))
}
module "vpc" {
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
cidr_block = var.vpc_cidr_block
tags = local.tags
}
module "subnets" {
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.18.1"
availability_zones = var.availability_zones
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
nat_gateway_enabled = true
nat_instance_enabled = false
tags = local.tags
}
module "eks_cluster" {
source = "git::https://github.com/cloudposse/terraform-aws-eks-cluster.git?ref=tags/0.13.0"
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
tags = var.tags
region = var.region
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_ids
kubernetes_version = var.kubernetes_version
kubeconfig_path = var.kubeconfig_path
oidc_provider_enabled = var.oidc_provider_enabled
workers_role_arns = [module.eks_node_group.eks_node_group_role_arn, module.eks_fargate_profile.eks_fargate_profile_role_arn]
workers_security_group_ids = []
}
module "eks_node_group" {
source = "git::https://github.com/cloudposse/terraform-aws-eks-node-group.git?ref=tags/0.1.0"
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
tags = var.tags
subnet_ids = module.subnets.public_subnet_ids
instance_types = var.instance_types
desired_size = var.desired_size
min_size = var.min_size
max_size = var.max_size
cluster_name = module.eks_cluster.eks_cluster_id
kubernetes_version = var.kubernetes_version
kubernetes_labels = var.kubernetes_labels
}
module "eks_fargate_profile" {
source = "git::https://github.com/cloudposse/terraform-aws-eks-fargate-profile.git?ref=master"
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
tags = var.tags
subnet_ids = module.subnets.private_subnet_ids
cluster_name = module.eks_cluster.eks_cluster_id
kubernetes_namespace = var.kubernetes_namespace
kubernetes_labels = var.kubernetes_labels
}
```
## Makefile Targets
```
Available targets:
help Help screen
help/all Display help for all targets
help/short This help short screen
lint Lint terraform code
```
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| attributes | Additional attributes (e.g. `1`) | list(string) | `` | no |
| cluster_name | The name of the EKS cluster | string | - | yes |
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
| enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources | bool | `true` | no |
| kubernetes_labels | Key-value mapping of Kubernetes labels for selection | map(string) | `