mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-26 11:21:04 +01:00
feat: Add support for networking ip_family which enables support for IPV6 (#1759)
This commit is contained in:
@@ -29,13 +29,13 @@ module "fargate_profile" {
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
|
||||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
|
||||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72 |
|
||||
|
||||
## Providers
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |
|
||||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.72 |
|
||||
|
||||
## Modules
|
||||
|
||||
@@ -48,6 +48,7 @@ No modules.
|
||||
| [aws_eks_fargate_profile.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_fargate_profile) | resource |
|
||||
| [aws_iam_role.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
|
||||
| [aws_iam_role_policy_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
|
||||
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
|
||||
| [aws_iam_policy_document.assume_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
|
||||
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
|
||||
|
||||
@@ -55,11 +56,13 @@ No modules.
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|------|---------|:--------:|
|
||||
| <a name="input_cluster_ip_family"></a> [cluster\_ip\_family](#input\_cluster\_ip\_family) | The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6` | `string` | `null` | no |
|
||||
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the EKS cluster | `string` | `null` | no |
|
||||
| <a name="input_create"></a> [create](#input\_create) | Determines whether to create Fargate profile or not | `bool` | `true` | no |
|
||||
| <a name="input_create_iam_role"></a> [create\_iam\_role](#input\_create\_iam\_role) | Determines whether an IAM role is created or to use an existing IAM role | `bool` | `true` | no |
|
||||
| <a name="input_iam_role_additional_policies"></a> [iam\_role\_additional\_policies](#input\_iam\_role\_additional\_policies) | Additional policies to be added to the IAM role | `list(string)` | `[]` | no |
|
||||
| <a name="input_iam_role_arn"></a> [iam\_role\_arn](#input\_iam\_role\_arn) | Existing IAM role ARN for the Fargate profile. Required if `create_iam_role` is set to `false` | `string` | `null` | no |
|
||||
| <a name="input_iam_role_attach_cni_policy"></a> [iam\_role\_attach\_cni\_policy](#input\_iam\_role\_attach\_cni\_policy) | Whether to attach the `AmazonEKS_CNI_Policy`/`AmazonEKS_CNI_IPv6_Policy` IAM policy to the IAM IAM role. WARNING: If set `false` the permissions must be assigned to the `aws-node` DaemonSet pods via another method or nodes will not be able to join the cluster | `bool` | `true` | no |
|
||||
| <a name="input_iam_role_description"></a> [iam\_role\_description](#input\_iam\_role\_description) | Description of the role | `string` | `null` | no |
|
||||
| <a name="input_iam_role_name"></a> [iam\_role\_name](#input\_iam\_role\_name) | Name to use on IAM role created | `string` | `""` | no |
|
||||
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | IAM role path | `string` | `null` | no |
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
data "aws_partition" "current" {}
|
||||
|
||||
data "aws_caller_identity" "current" {}
|
||||
|
||||
locals {
|
||||
iam_role_name = coalesce(var.iam_role_name, var.name, "fargate-profile")
|
||||
policy_arn_prefix = "arn:${data.aws_partition.current.partition}:iam::aws:policy"
|
||||
iam_role_name = coalesce(var.iam_role_name, var.name, "fargate-profile")
|
||||
|
||||
iam_role_policy_prefix = "arn:${data.aws_partition.current.partition}:iam::aws:policy"
|
||||
|
||||
cni_policy = var.cluster_ip_family == "ipv6" ? "arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:policy/AmazonEKS_CNI_IPv6_Policy" : "${local.iam_role_policy_prefix}/AmazonEKS_CNI_Policy"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -40,7 +45,8 @@ resource "aws_iam_role" "this" {
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "this" {
|
||||
for_each = var.create && var.create_iam_role ? toset(compact(distinct(concat([
|
||||
"${local.policy_arn_prefix}/AmazonEKSFargatePodExecutionRolePolicy",
|
||||
"${local.iam_role_policy_prefix}/AmazonEKSFargatePodExecutionRolePolicy",
|
||||
var.iam_role_attach_cni_policy ? local.cni_policy : "",
|
||||
], var.iam_role_additional_policies)))) : toset([])
|
||||
|
||||
policy_arn = each.value
|
||||
|
||||
@@ -20,6 +20,12 @@ variable "create_iam_role" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "cluster_ip_family" {
|
||||
description = "The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`"
|
||||
type = string
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "iam_role_arn" {
|
||||
description = "Existing IAM role ARN for the Fargate profile. Required if `create_iam_role` is set to `false`"
|
||||
type = string
|
||||
@@ -56,6 +62,12 @@ variable "iam_role_permissions_boundary" {
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "iam_role_attach_cni_policy" {
|
||||
description = "Whether to attach the `AmazonEKS_CNI_Policy`/`AmazonEKS_CNI_IPv6_Policy` IAM policy to the IAM IAM role. WARNING: If set `false` the permissions must be assigned to the `aws-node` DaemonSet pods via another method or nodes will not be able to join the cluster"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "iam_role_additional_policies" {
|
||||
description = "Additional policies to be added to the IAM role"
|
||||
type = list(string)
|
||||
|
||||
@@ -4,7 +4,7 @@ terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = ">= 3.64"
|
||||
version = ">= 3.72"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user