Skip to content

Commit

Permalink
Merge pull request #19 from radiant-maxar/release-0.6.5
Browse files Browse the repository at this point in the history
Release 0.6.5
  • Loading branch information
jbronn authored Jan 19, 2024
2 parents fa1cdd3 + 6fbddb3 commit 3b59c70
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cert-manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
module "cert_manager_irsa" {
count = var.cert_manager ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-cert-manager-role"

Expand Down
17 changes: 5 additions & 12 deletions crossplane.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
## Crossplane
module "crossplane_irsa" {
count = var.crossplane ? 1 : 0
count = var.crossplane && var.crossplane_irsa ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-crossplane-role"

assume_role_condition_test = "StringLike"
oidc_providers = {
main = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = [
"${var.crossplane_namespace}:crossplane-system:provider-aws-*",
"${var.crossplane_namespace}:${var.crossplane_service_account_name}",
]
}
}
tags = var.tags
}

resource "aws_iam_role_policy_attachment" "crossplane" {
count = var.crossplane ? length(var.crossplane_policy_arns) : 0
count = var.crossplane && var.crossplane_irsa ? length(var.crossplane_policy_arns) : 0
role = module.crossplane_irsa[0].iam_role_name
policy_arn = var.crossplane_policy_arns[count.index]
depends_on = [
Expand All @@ -37,18 +38,10 @@ resource "helm_release" "crossplane" {
wait = var.crossplane_wait

values = [
yamlencode({
serviceAccount = {
annotations = {
"eks.amazonaws.com/role-arn" = module.crossplane_irsa[0].iam_role_arn
}
}
}),
yamlencode(var.crossplane_values),
]

depends_on = [
module.crossplane_irsa[0],
module.eks,
]
}
2 changes: 1 addition & 1 deletion ebs-csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module "eks_ebs_csi_driver_irsa" {
count = var.ebs_csi_driver ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-ebs-csi-role"
attach_ebs_csi_policy = true
Expand Down
2 changes: 1 addition & 1 deletion efs-csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "aws_efs_mount_target" "eks_efs_private" {
module "eks_efs_csi_driver_irsa" {
count = var.efs_csi_driver ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-efs-csi-driver-role"

Expand Down
2 changes: 1 addition & 1 deletion lb-controller.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module "eks_lb_irsa" {
count = var.lb_controller ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-lb-role"
attach_load_balancer_controller_policy = true
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ output "cluster_primary_security_group_id" {

output "crossplane_role_arn" {
description = "The Crossplane IRSA role Amazon Resource Name (ARN)"
value = var.crossplane ? module.crossplane_irsa[0].iam_role_arn : null
value = var.crossplane && var.crossplane_irsa ? module.crossplane_irsa[0].iam_role_arn : null
}

output "crossplane_role_name" {
description = "The Crossplane IRSA role name"
value = var.crossplane ? module.crossplane_irsa[0].iam_role_name : null
value = var.crossplane && var.crossplane_irsa ? module.crossplane_irsa[0].iam_role_name : null
}

output "ebs_csi_driver_role_arn" {
Expand Down
2 changes: 1 addition & 1 deletion s3-csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "eks_s3_csi_driver_irsa" {
count = var.s3_csi_driver ? 1 : 0

source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-s3-csi-driver-role"

Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ variable "crossplane" {
default = false
}

variable "crossplane_irsa" {
description = "Indicates whether to create an IRSA role for Crossplane."
type = bool
default = true
}

variable "crossplane_namespace" {
default = "crossplane-system"
description = "Namespace that Crossplane will use."
Expand All @@ -139,6 +145,12 @@ variable "crossplane_policy_arns" {
type = list(string)
}

variable "crossplane_service_account_name" {
default = "provider-aws-*"
description = "Crossplane service account name for IRSA binding."
type = string
}

variable "crossplane_values" {
description = "Additional custom values for the Crossplane Helm chart."
type = any
Expand Down
2 changes: 1 addition & 1 deletion vpc-cni.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module "eks_vpc_cni_irsa" {
count = var.vpc_cni ? 1 : 0
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "5.33.0"
version = "~> 5.33.1"

role_name = "${var.cluster_name}-vpc-cni-role"

Expand Down

0 comments on commit 3b59c70

Please sign in to comment.