Skip to content

Commit

Permalink
variable name change + usage
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 committed Jul 30, 2020
1 parent e36ca9a commit 90e2738
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# Kubernetes EBS CSI driver Terraform module

Terraform module which creates Kubernetes EBS CSI controller resources on AWS EKS.

## Usage

```hcl
data "aws_eks_cluster" "cluster" {
name = "my-eks-cluster"
}
data "aws_eks_cluster_auth" "cluster" {
name = "my-eks-cluster"
}
data "tls_certificate" "cert" {
url = data.aws_eks_cluster.identity[0].oidc[0].issuer
}
resource "aws_iam_openid_connect_provider" "openid_connect" {
client_id_list = ["sts.amazonaws.com"]
thumbprint_list = [data.tls_certificate.cert.certificates.0.sha1_fingerprint]
url = data.aws_eks_cluster.identity[0].oidc[0].issuer
}
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
load_config_file = false
version = "~> 1.11.4"
}
module "ebs_csi_driver_controller" {
source = "TBD"
ebs_csi_controller_role_name = "ebs-csi-driver-controller"
ebs_csi_controller_role_policy_name_prefix = "ebs-csi-driver-policy"
oidc_url = aws_iam_openid_connect_provider.openid_connect.url
}
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

Expand All @@ -17,16 +59,16 @@

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| csi\_controller\_replica\_count | Number of EBS CSI driver controller pods | `number` | `2` | no |
| csi\_controller\_tolerations | CSI driver controller tolerations | `map(string)` | `{}` | no |
| ebs\_csi\_controller\_role\_name | The name of the EBS CSI driver IAM role | `string` | `"ebs-csi-driver-controller"` | no |
| ebs\_csi\_controller\_role\_policy\_name\_prefix | The prefix of the EBS CSI driver IAM policy | `string` | `"ebs-csi-driver-policy"` | no |
| enable\_volume\_resizing | Whether to enable volume resizing | `bool` | `false` | no |
| enable\_volume\_snapshot | Whether to enable volume snapshotting | `bool` | `false` | no |
| namespace | The K8s namespace for all EBS CSI driver resources | `string` | `"kube-system"` | no |
| node\_tolerations | CSI driver node tolerations | `map(string)` | `{}` | no |
| oidc\_url | EKS OIDC provider URL, to allow pod to assume role using IRSA | `string` | n/a | yes |
| replica\_count | Number of EBS CSI driver controller pods | `number` | `2` | no |
| tags | A map of tags to add to all resources | `map(string)` | `{}` | no |
| tolerations | CSI driver controller tolerations | `map(string)` | `{}` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions controller.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "kubernetes_deployment" "ebs_csi_controller" {
namespace = var.namespace
}
spec {
replicas = var.replica_count
replicas = var.csi_controller_replica_count
selector {
match_labels = {
app = local.name
Expand All @@ -33,7 +33,7 @@ resource "kubernetes_deployment" "ebs_csi_controller" {

toleration = merge({
operator = "Exists"
}, var.tolerations)
}, var.csi_controller_tolerations)

container {
name = "ebs-plugin"
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ variable "node_tolerations" {
default = {}
}

variable "tolerations" {
variable "csi_controller_tolerations" {
description = "CSI driver controller tolerations"
type = map(string)
default = {}
}

variable "replica_count" {
variable "csi_controller_replica_count" {
description = "Number of EBS CSI driver controller pods"
type = number
default = 2
Expand Down

0 comments on commit 90e2738

Please sign in to comment.