Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: support generic adoption variables #140

Merged
merged 36 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1a5e97b
Disable aws_iam_policy_document when enable_resource_creation is false
maxsxu Jul 28, 2024
6b35c23
Upgrade to terraform-aws-modules v20.23.0
maxsxu Aug 14, 2024
73b28eb
Fix count access
maxsxu Sep 4, 2024
a4cbf64
Defaulting node groups
maxsxu Sep 4, 2024
3846619
Use object
maxsxu Sep 5, 2024
85999a6
Resolve true and false result expressions must have consistent types
maxsxu Sep 5, 2024
96efbd3
Add cluster_iam
maxsxu Sep 5, 2024
67d8420
Fix try at least have one result
maxsxu Sep 5, 2024
6b9bff4
Add cluster_networking
maxsxu Sep 8, 2024
52777c0
Fix count index
maxsxu Sep 8, 2024
2c33543
Fix cluster_security_group_name default value
maxsxu Sep 8, 2024
5ed0e9f
Upgrade aws provider version
maxsxu Sep 18, 2024
2478fbc
Update
maxsxu Sep 19, 2024
24600fd
Update CI
maxsxu Sep 19, 2024
a8df79e
Update docs
maxsxu Sep 20, 2024
858b4ed
Update
maxsxu Sep 20, 2024
b44ca98
Changed output to eks_cluster_name
dpappa Sep 23, 2024
052a354
Set use_name_prefix to true for v2 node groups. Check for null var.no…
dpappa Sep 23, 2024
0d3b7a1
Remove unused examples
maxsxu Sep 24, 2024
a64388d
Using 20.24.2
maxsxu Sep 24, 2024
7d57a26
Update main.tf
mitch-hamm Sep 26, 2024
4f77606
Set encryption off by default
mitch-hamm Sep 27, 2024
d47b13c
Revert "Set encryption off by default"
maxsxu Oct 8, 2024
50bfc48
Revert "Update main.tf"
maxsxu Oct 8, 2024
cff881c
Set cluster_encryption_policy_path to StreamNative
maxsxu Oct 8, 2024
443c69e
Set enable_cluster_creator_admin_permissions and nodes update_config
maxsxu Oct 15, 2024
7d8d6e5
Add node group iam role
maxsxu Oct 15, 2024
699dc44
Set encryption config as empty by default after failed testing
mitch-hamm Oct 16, 2024
572a19e
feat: Expose route tables info (#138)
ciiiii Sep 10, 2024
161c5bc
chore(master): release 3.2.0 (#139)
github-actions[bot] Sep 10, 2024
6cec69e
Merge branch 'master' into max/adoption
maxsxu Oct 17, 2024
bf627ad
docs: update tf docs
maxsxu Oct 25, 2024
992373f
Add move block for eks_auth module
maxsxu Oct 27, 2024
e1b9b6c
Merge branch 'master' into max/adoption
maxsxu Nov 11, 2024
2d80ef3
Update to eks module 20.29.0
maxsxu Nov 11, 2024
fdc7ae8
Update tf docs
maxsxu Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "TF GH Action"
name: Terraform

on:
- pull_request

Expand All @@ -11,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.1.x
terraform_version: "1.5.5"

- name: Terraform fmt
run: terraform fmt -recursive -write=false -check -diff .
Expand All @@ -27,21 +28,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
terraform_version: [1.1.x]
terraform_version: ["1.5.5"]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Terraform ${{ matrix.terraform_version }}
uses: hashicorp/setup-terraform@v1.3.2
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform_version }}

- name: Terraform Validate Root
run: cd "${GITHUB_WORKSPACE}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate -no-color
run: cd "${GITHUB_WORKSPACE}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate

- name: Terraform Validate Modules
run: for module in modules/*/; do cd "${GITHUB_WORKSPACE}/${module}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate -no-color ; done
run: for module in modules/*/; do cd "${GITHUB_WORKSPACE}/${module}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate; done

- name: Terraform Validate Examples
run: for example in examples/*/; do cd "${GITHUB_WORKSPACE}/${example}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate -no-color ; done
run: for example in examples/*/; do cd "${GITHUB_WORKSPACE}/${example}" && terraform init -backend=false && AWS_REGION=us-east-1 terraform validate; done
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ A bare minimum configuration to execute the module:

```hcl
data "aws_eks_cluster" "cluster" {
name = module.eks_cluster.eks_cluster_id
name = module.eks_cluster.eks_cluster_name
}

data "aws_eks_cluster_auth" "cluster" {
name = module.eks_cluster.eks_cluster_id
name = module.eks_cluster.eks_cluster_name
}

provider "aws" {
Expand Down Expand Up @@ -168,24 +168,25 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >=3.61.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | 2.2.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >=2.6.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.75 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.16 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.32 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.71.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.16.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.75.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.16.1 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.33.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 18.30.2 |
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 20.29.0 |
| <a name="module_eks_auth"></a> [eks\_auth](#module\_eks\_auth) | terraform-aws-modules/eks/aws//modules/aws-auth | 20.29.0 |
| <a name="module_istio"></a> [istio](#module\_istio) | github.com/streamnative/terraform-helm-charts//modules/istio-operator | v0.8.6 |
| <a name="module_vpc_tags"></a> [vpc\_tags](#module\_vpc\_tags) | ./modules/eks-vpc-tags | n/a |

Expand Down Expand Up @@ -225,16 +226,16 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir
| [aws_s3_bucket.velero](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.tiered_storage](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.velero](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [helm_release.aws_load_balancer_controller](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.cert_issuer](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.cert_manager](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.cilium](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.cluster_autoscaler](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.csi](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.external_dns](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.metrics_server](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.node_termination_handler](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.velero](https://registry.terraform.io/providers/hashicorp/helm/2.2.0/docs/resources/release) | resource |
| [helm_release.aws_load_balancer_controller](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.cert_issuer](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.cert_manager](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.cilium](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.cluster_autoscaler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.csi](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.external_dns](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.metrics_server](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.node_termination_handler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.velero](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.sn_system](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_namespace.velero](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_storage_class.sn_default](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource |
Expand Down Expand Up @@ -393,10 +394,10 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir
| <a name="output_eks_cluster_arn"></a> [eks\_cluster\_arn](#output\_eks\_cluster\_arn) | The ARN for the EKS cluster created by this module |
| <a name="output_eks_cluster_certificate_authority_data"></a> [eks\_cluster\_certificate\_authority\_data](#output\_eks\_cluster\_certificate\_authority\_data) | Base64 encoded certificate data required to communicate with the cluster |
| <a name="output_eks_cluster_endpoint"></a> [eks\_cluster\_endpoint](#output\_eks\_cluster\_endpoint) | The endpoint for the EKS cluster created by this module |
| <a name="output_eks_cluster_id"></a> [eks\_cluster\_id](#output\_eks\_cluster\_id) | The id/name of the EKS cluster created by this module |
| <a name="output_eks_cluster_identity_oidc_issuer_arn"></a> [eks\_cluster\_identity\_oidc\_issuer\_arn](#output\_eks\_cluster\_identity\_oidc\_issuer\_arn) | The ARN for the OIDC issuer created by this module |
| <a name="output_eks_cluster_identity_oidc_issuer_string"></a> [eks\_cluster\_identity\_oidc\_issuer\_string](#output\_eks\_cluster\_identity\_oidc\_issuer\_string) | A formatted string containing the prefix for the OIDC issuer created by this module. Same as "cluster\_oidc\_issuer\_url", but with "https://" stripped from the name. This output is typically used in other StreamNative modules that request the "oidc\_issuer" input. |
| <a name="output_eks_cluster_identity_oidc_issuer_url"></a> [eks\_cluster\_identity\_oidc\_issuer\_url](#output\_eks\_cluster\_identity\_oidc\_issuer\_url) | The URL for the OIDC issuer created by this module |
| <a name="output_eks_cluster_name"></a> [eks\_cluster\_name](#output\_eks\_cluster\_name) | The name of the EKS cluster created by this module |
| <a name="output_eks_cluster_platform_version"></a> [eks\_cluster\_platform\_version](#output\_eks\_cluster\_platform\_version) | The platform version for the EKS cluster created by this module |
| <a name="output_eks_cluster_primary_security_group_id"></a> [eks\_cluster\_primary\_security\_group\_id](#output\_eks\_cluster\_primary\_security\_group\_id) | The id of the primary security group created by the EKS service itself, not by this module. This is labeled "Cluster Security Group" in the EKS console. |
| <a name="output_eks_cluster_secondary_security_group_id"></a> [eks\_cluster\_secondary\_security\_group\_id](#output\_eks\_cluster\_secondary\_security\_group\_id) | The id of the secondary security group created by this module. This is labled "Additional Security Groups" in the EKS console. |
Expand Down
8 changes: 6 additions & 2 deletions aws_load_balancer_controller.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.

data "aws_iam_policy_document" "aws_load_balancer_controller" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"iam:CreateServiceLinkedRole",
Expand Down Expand Up @@ -237,6 +239,8 @@ data "aws_iam_policy_document" "aws_load_balancer_controller" {
}

data "aws_iam_policy_document" "aws_load_balancer_controller_sts" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"sts:AssumeRoleWithWebIdentity"
Expand All @@ -258,7 +262,7 @@ resource "aws_iam_role" "aws_load_balancer_controller" {
count = var.enable_resource_creation ? 1 : 0
name = format("%s-lbc-role", module.eks.cluster_id)
description = format("Role used by IRSA and the KSA aws-load-balancer-controller on StreamNative Cloud EKS cluster %s", module.eks.cluster_id)
assume_role_policy = data.aws_iam_policy_document.aws_load_balancer_controller_sts.json
assume_role_policy = data.aws_iam_policy_document.aws_load_balancer_controller_sts.0.json
path = "/StreamNative/"
permissions_boundary = var.permissions_boundary_arn
tags = local.tags
Expand All @@ -275,7 +279,7 @@ resource "aws_iam_policy" "aws_load_balancer_controller" {
name = format("%s-AWSLoadBalancerControllerPolicy", module.eks.cluster_id)
description = "Policy that defines the permissions for the AWS Load Balancer Controller addon service running in a StreamNative Cloud EKS cluster"
path = "/StreamNative/"
policy = data.aws_iam_policy_document.aws_load_balancer_controller.json
policy = data.aws_iam_policy_document.aws_load_balancer_controller.0.json
tags = local.tags
}

Expand Down
8 changes: 6 additions & 2 deletions cert_manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.

data "aws_iam_policy_document" "cert_manager" {
count = var.enable_resource_creation ? 1 : 0

statement {
sid = "Changes"
actions = [
Expand Down Expand Up @@ -49,6 +51,8 @@ data "aws_iam_policy_document" "cert_manager" {
}

data "aws_iam_policy_document" "cert_manager_sts" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"sts:AssumeRoleWithWebIdentity"
Expand All @@ -70,7 +74,7 @@ resource "aws_iam_role" "cert_manager" {
count = var.enable_resource_creation ? 1 : 0
name = format("%s-cm-role", module.eks.cluster_id)
description = format("Role assumed by IRSA and the KSA cert-manager on StreamNative Cloud EKS cluster %s", module.eks.cluster_id)
assume_role_policy = data.aws_iam_policy_document.cert_manager_sts.json
assume_role_policy = data.aws_iam_policy_document.cert_manager_sts.0.json
path = "/StreamNative/"
permissions_boundary = var.permissions_boundary_arn
tags = local.tags
Expand All @@ -87,7 +91,7 @@ resource "aws_iam_policy" "cert_manager" {
name = format("%s-CertManagerPolicy", module.eks.cluster_id)
description = "Policy that defines the permissions for the Cert-Manager addon service running in a StreamNative Cloud EKS cluster"
path = "/StreamNative/"
policy = data.aws_iam_policy_document.cert_manager.json
policy = data.aws_iam_policy_document.cert_manager.0.json
tags = local.tags
}

Expand Down
8 changes: 6 additions & 2 deletions cluster_autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.

data "aws_iam_policy_document" "cluster_autoscaler" {
count = var.enable_resource_creation ? 1 : 0

statement {
effect = "Allow"

Expand Down Expand Up @@ -51,6 +53,8 @@ data "aws_iam_policy_document" "cluster_autoscaler" {
}

data "aws_iam_policy_document" "cluster_autoscaler_sts" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"sts:AssumeRoleWithWebIdentity"
Expand All @@ -77,7 +81,7 @@ resource "aws_iam_role" "cluster_autoscaler" {
count = var.enable_resource_creation ? 1 : 0
name = format("%s-ca-role", module.eks.cluster_id)
description = format("Role used by IRSA and the KSA cluster-autoscaler on StreamNative Cloud EKS cluster %s", module.eks.cluster_id)
assume_role_policy = data.aws_iam_policy_document.cluster_autoscaler_sts.json
assume_role_policy = data.aws_iam_policy_document.cluster_autoscaler_sts.0.json
path = "/StreamNative/"
permissions_boundary = var.permissions_boundary_arn
tags = local.tags
Expand All @@ -94,7 +98,7 @@ resource "aws_iam_policy" "cluster_autoscaler" {
name = format("%s-ClusterAutoscalerPolicy", module.eks.cluster_id)
description = "Policy that defines the permissions for the Cluster Autoscaler addon service running in a StreamNative Cloud EKS cluster"
path = "/StreamNative/"
policy = data.aws_iam_policy_document.cluster_autoscaler.json
policy = data.aws_iam_policy_document.cluster_autoscaler.0.json
tags = local.tags
}

Expand Down
8 changes: 6 additions & 2 deletions csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.

data "aws_iam_policy_document" "csi" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"ec2:CreateSnapshot",
Expand Down Expand Up @@ -142,6 +144,8 @@ data "aws_iam_policy_document" "csi" {
}

data "aws_iam_policy_document" "csi_sts" {
count = var.enable_resource_creation ? 1 : 0

statement {
actions = [
"sts:AssumeRoleWithWebIdentity"
Expand All @@ -168,7 +172,7 @@ resource "aws_iam_role" "csi" {
count = var.enable_resource_creation ? 1 : 0
name = format("%s-csi-role", module.eks.cluster_id)
description = format("Role used by IRSA and the KSA ebs-csi-controller-sa on StreamNative Cloud EKS cluster %s", module.eks.cluster_id)
assume_role_policy = data.aws_iam_policy_document.csi_sts.json
assume_role_policy = data.aws_iam_policy_document.csi_sts.0.json
path = "/StreamNative/"
permissions_boundary = var.permissions_boundary_arn
tags = local.tags
Expand All @@ -185,7 +189,7 @@ resource "aws_iam_policy" "csi" {
name = format("%s-CsiPolicy", module.eks.cluster_id)
description = "Policy that defines the permissions for the EBS Container Storage Interface CSI addon service running in a StreamNative Cloud EKS cluster"
path = "/StreamNative/"
policy = data.aws_iam_policy_document.csi.json
policy = data.aws_iam_policy_document.csi.0.json
tags = local.tags
}

Expand Down
Loading
Loading