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

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
32 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
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
12 changes: 6 additions & 6 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,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,13 +27,13 @@ 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 }}

Expand Down
33 changes: 19 additions & 14 deletions README.md

Large diffs are not rendered by default.

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
4 changes: 2 additions & 2 deletions examples/example-with-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ terraform {
### These data sources are required by the Kubernetes and Helm providers in order to connect to the newly provisioned cluster
#######
data "aws_eks_cluster" "cluster" {
name = module.sn_cluster.eks_cluster_id
name = module.sn_cluster.eks_cluster_name
}

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

data "aws_caller_identity" "current" {}
Expand Down
4 changes: 2 additions & 2 deletions examples/root-example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ variable "region" {
### These data sources are required by the Kubernetes and Helm providers in order to connect to the newly provisioned cluster
#######
data "aws_eks_cluster" "cluster" {
name = module.sn_cluster.eks_cluster_id
name = module.sn_cluster.eks_cluster_name
}

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

provider "aws" {
Expand Down
14 changes: 7 additions & 7 deletions examples/streamnative-platform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ provider "kubernetes" {
}

data "aws_eks_cluster" "cluster" {
name = module.sn_cluster.eks_cluster_id
name = module.sn_cluster.eks_cluster_name
}

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

data "aws_caller_identity" "current" {}
Expand Down Expand Up @@ -131,7 +131,7 @@ module "sn_bootstrap" {
module "sn_tiered_storage_resources" {
source = "github.com/streamnative/terraform-aws-cloud//modules/tiered-storage-resources?ref=v2.2.4-alpha"

cluster_name = module.sn_cluster.eks_cluster_id
cluster_name = module.sn_cluster.eks_cluster_name
oidc_issuer = module.sn_cluster.eks_cluster_identity_oidc_issuer_string
pulsar_namespace = local.pulsar_namespace

Expand All @@ -151,7 +151,7 @@ module "sn_tiered_storage_resources" {
module "sn_tiered_storage_vault_resources" {
source = "github.com/streamnative/terraform-aws-cloud//modules/vault-resources?ref=v2.2.4-alpha"

cluster_name = module.sn_cluster.eks_cluster_id
cluster_name = module.sn_cluster.eks_cluster_name
oidc_issuer = module.sn_cluster.eks_cluster_identity_oidc_issuer_string
pulsar_namespace = local.pulsar_namespace

Expand Down Expand Up @@ -183,11 +183,11 @@ output "cleanup_for_destroying_cluster" {
}

output "connect_to_cluster" {
value = format("aws eks update-kubeconfig --name %s --kubeconfig ~/.kube/config --region %s", module.sn_cluster.eks_cluster_id, local.region)
value = format("aws eks update-kubeconfig --name %s --kubeconfig ~/.kube/config --region %s", module.sn_cluster.eks_cluster_name, local.region)
}

output "eks_cluster_id" {
value = module.sn_cluster.eks_cluster_id
output "eks_cluster_name" {
value = module.sn_cluster.eks_cluster_name
}

output "vpc_id" {
Expand Down
8 changes: 6 additions & 2 deletions external_dns.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" "external_dns" {
count = var.enable_resource_creation ? 1 : 0

statement {
sid = "ChangeResourceRecordSets"
actions = [
Expand All @@ -39,6 +41,8 @@ data "aws_iam_policy_document" "external_dns" {
}

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

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

Expand Down
Loading
Loading