Skip to content
This repository was archived by the owner on Jan 31, 2021. It is now read-only.

Commit 5b2047e

Browse files
authored
Enable disabled module to delete resources (#5)
1 parent 02ec81d commit 5b2047e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

main.tf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,23 @@ data "template_file" "config" {
2424

2525
# https://www.terraform.io/docs/providers/kubernetes/guides/getting-started.html
2626
# https://www.terraform.io/docs/providers/kubernetes/index.html
27+
# https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-instances
2728
provider "kubernetes" {
28-
config_path = "${var.kube_config_path}"
29-
load_config_file = "${var.enabled == "true"}"
29+
alias = "aws_iam_authenticator"
30+
31+
# Even when this module is disabled, if a previous, enabled version created
32+
# kubernetes_config_map.aws_iam_authenticator
33+
# you will need to provide a valid kube_config_path to enable terraform to query and delete that resource
34+
config_path = "${var.kube_config_path}"
35+
36+
load_config_file = true
3037
}
3138

3239
# https://github.com/kubernetes/kops/blob/master/docs/authentication.md
3340
# https://github.com/kubernetes-sigs/aws-iam-authenticator
3441
resource "kubernetes_config_map" "aws_iam_authenticator" {
35-
count = "${var.enabled == "true" ? 1 : 0}"
42+
count = "${var.enabled == "true" ? 1 : 0}"
43+
provider = "kubernetes.aws_iam_authenticator"
3644

3745
metadata {
3846
name = "aws-iam-authenticator"

0 commit comments

Comments
 (0)