Skip to content

Commit

Permalink
Merge pull request #6 from lablabs/remove-values-use-set
Browse files Browse the repository at this point in the history
Remove values template and use set blocks for attributes
  • Loading branch information
adys authored Jul 16, 2020
2 parents 3975c82 + fd37723 commit 4e64e10
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.terraform/*
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ A terraform module to deploy an Application Load Balancer (ALB) Ingress Controll

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| cluster\_identity\_oidc\_issuer | n/a | `any` | n/a | yes |
| cluster\_identity\_oidc\_issuer\_arn | n/a | `any` | n/a | yes |
| cluster\_name | n/a | `any` | n/a | yes |
| cluster\_identity\_oidc\_issuer | The OIDC Identity issuer for the cluster | `string` | n/a | yes |
| cluster\_identity\_oidc\_issuer\_arn | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account | `string` | n/a | yes |
| cluster\_name | The name of the cluster | `string` | n/a | yes |
| enabled | n/a | `bool` | n/a | yes |
| helm\_chart\_name | n/a | `string` | `"aws-alb-ingress-controller"` | no |
| helm\_chart\_version | n/a | `string` | `"0.1.13"` | no |
| helm\_release\_name | n/a | `string` | `"aws-alb-ingress-controller"` | no |
| helm\_repo\_url | n/a | `string` | `"http://storage.googleapis.com/kubernetes-charts-incubator"` | no |
| ingress\_class | n/a | `string` | `"alb-ingress"` | no |
| k8s\_namespace | The k8s namespace in which the alb-ingress service account has been created | `string` | `"alb-ingress"` | no |
| k8s\_service\_account\_name | The k8s alb-ingress service account name | `string` | `"aws-alb-ingress-controller"` | no |
| mod\_dependency | Dependence variable binds all AWS resources allocated by this module, dependent modules reference this variable | `any` | `null` | no |
| replica\_count | n/a | `number` | `2` | no |
| settings | Additional settings which will be passed to the Helm chart values, see https://hub.helm.sh/charts/incubator/aws-alb-ingress-controller | `map(any)` | `{}` | no |

## Outputs

Expand Down
38 changes: 28 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,32 @@ resource "helm_release" "alb_ingress" {
namespace = var.k8s_namespace
version = var.helm_chart_version

values = [
"${templatefile("${path.module}/templates/values.yaml.tpl",
{
"cluster_name" = var.cluster_name,
"alb_ingress_iam_role_arn" = aws_iam_role.alb_ingress[0].arn
"replica_count" = var.replica_count
"ingress_class" = var.ingress_class
})
}"
]
set {
name = "clusterName"
value = var.cluster_name
}

set {
name = "rbac.create"
value = "true"
}

set {
name = "rbac.serviceAccount.create"
value = "true"
}

set {
name = "rbac.serviceAccountAnnotations.eks\\.amazonaws\\.com/role-arn"
value = aws_iam_role.alb_ingress[0].arn
}

dynamic "set" {
for_each = var.settings

content {
name = set.key
value = set.value
}
}
}
32 changes: 0 additions & 32 deletions templates/values.yaml.tpl

This file was deleted.

31 changes: 20 additions & 11 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Required module inputs

variable "cluster_name" {}
variable "cluster_identity_oidc_issuer" {}
variable "cluster_identity_oidc_issuer_arn" {}

# alb-ingress
variable "cluster_name" {
type = string
description = "The name of the cluster"
}

variable "enabled" {
type = bool
variable "cluster_identity_oidc_issuer" {
type = string
description = "The OIDC Identity issuer for the cluster"
}

variable "replica_count" {
default = 2
variable "cluster_identity_oidc_issuer_arn" {
type = string
description = "The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account"
}

variable "ingress_class" {
default = "alb-ingress"
# alb-ingress

variable "enabled" {
type = bool
}

# Helm
Expand Down Expand Up @@ -52,3 +55,9 @@ variable "mod_dependency" {
default = null
description = "Dependence variable binds all AWS resources allocated by this module, dependent modules reference this variable"
}

variable "settings" {
type = map(any)
default = {}
description = "Additional settings which will be passed to the Helm chart values, see https://hub.helm.sh/charts/incubator/aws-alb-ingress-controller"
}

0 comments on commit 4e64e10

Please sign in to comment.