Skip to content

Commit

Permalink
feat: add k8s provider config variables (cloudposse#78)
Browse files Browse the repository at this point in the history
* feat: add variable for loading k8s config file

* Updated README.md

* feat: add kubernetes_config_path variable

* Updated README.md

Co-authored-by: actions-bot <[email protected]>
  • Loading branch information
dotCipher and actions-bot authored Sep 23, 2020
1 parent df8b991 commit 77dc7dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ Available targets:
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| kubernetes\_config\_map\_ignore\_role\_changes | Set to `true` to ignore IAM role changes in the Kubernetes Auth ConfigMap | `bool` | `true` | no |
| kubernetes\_config\_path | Path to the kube config file. Defaults to `~/.kube/config` | `string` | `"~/.kube/config"` | no |
| kubernetes\_load\_config\_file | Loads the default local config of ~/.kube/config for the provider, which is useful for resolving migration issues like `Error: configmaps "aws-auth" already exists` | `bool` | `false` | no |
| kubernetes\_version | Desired Kubernetes master version. If you do not specify a value, the latest available version is used | `string` | `"1.15"` | no |
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
| local\_exec\_interpreter | shell to use for local\_exec | `list(string)` | <pre>[<br> "/bin/sh",<br> "-c"<br>]</pre> | no |
Expand Down
3 changes: 2 additions & 1 deletion auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ provider "kubernetes" {
token = join("", data.aws_eks_cluster_auth.eks.*.token)
host = join("", data.aws_eks_cluster.eks.*.endpoint)
cluster_ca_certificate = base64decode(join("", data.aws_eks_cluster.eks.*.certificate_authority.0.data))
load_config_file = false
load_config_file = var.kubernetes_load_config_file
config_path = var.kubernetes_config_path
}

resource "kubernetes_config_map" "aws_auth_ignore_changes" {
Expand Down
2 changes: 2 additions & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| kubernetes\_config\_map\_ignore\_role\_changes | Set to `true` to ignore IAM role changes in the Kubernetes Auth ConfigMap | `bool` | `true` | no |
| kubernetes\_config\_path | Path to the kube config file. Defaults to `~/.kube/config` | `string` | `"~/.kube/config"` | no |
| kubernetes\_load\_config\_file | Loads the default local config of ~/.kube/config for the provider, which is useful for resolving migration issues like `Error: configmaps "aws-auth" already exists` | `bool` | `false` | no |
| kubernetes\_version | Desired Kubernetes master version. If you do not specify a value, the latest available version is used | `string` | `"1.15"` | no |
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
| local\_exec\_interpreter | shell to use for local\_exec | `list(string)` | <pre>[<br> "/bin/sh",<br> "-c"<br>]</pre> | no |
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ variable "kubernetes_version" {
description = "Desired Kubernetes master version. If you do not specify a value, the latest available version is used"
}

variable "kubernetes_config_path" {
type = string
default = "~/.kube/config"
description = "Path to the kube config file. Defaults to `~/.kube/config`"
}

variable "kubernetes_load_config_file" {
type = bool
default = false
description = "Loads the default local config of ~/.kube/config for the provider, which is useful for resolving migration issues like `Error: configmaps \"aws-auth\" already exists`"
}

variable "oidc_provider_enabled" {
type = bool
default = false
Expand Down

0 comments on commit 77dc7dd

Please sign in to comment.