From d66f2b02aa47fcea700cc27f8fe737db040b0169 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Fri, 11 Feb 2022 16:03:55 -0500 Subject: [PATCH 1/2] feat: Add additional output for OIDC provider (issuer URL without leading `https://`) --- .pre-commit-config.yaml | 2 +- README.md | 1 + outputs.tf | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 093121e086..8a010fdd41 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.62.3 + rev: v1.64.0 hooks: - id: terraform_fmt - id: terraform_validate diff --git a/README.md b/README.md index 0f0c566de9..8f7aca78c2 100644 --- a/README.md +++ b/README.md @@ -844,6 +844,7 @@ Full contributing [guidelines are covered here](https://github.com/terraform-aws | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/outputs.tf b/outputs.tf index 36799b2dc5..05eaa5c808 100644 --- a/outputs.tf +++ b/outputs.tf @@ -74,6 +74,11 @@ output "node_security_group_id" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = replace(try(aws_eks_cluster.this[0].identity[0].oidc[0].issuer, ""), "https://", "") +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = try(aws_iam_openid_connect_provider.oidc_provider[0].arn, "") From c5b3a772c14f49fc278b6761575424c9791bdecb Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Fri, 11 Feb 2022 16:23:28 -0500 Subject: [PATCH 2/2] chore: fix ordering of string manipulation functions and propagate output to examples --- examples/complete/README.md | 1 + examples/complete/outputs.tf | 5 +++++ examples/eks_managed_node_group/README.md | 1 + examples/eks_managed_node_group/outputs.tf | 5 +++++ examples/fargate_profile/README.md | 1 + examples/fargate_profile/outputs.tf | 5 +++++ examples/irsa_autoscale_refresh/README.md | 1 + examples/irsa_autoscale_refresh/outputs.tf | 5 +++++ examples/self_managed_node_group/README.md | 1 + examples/self_managed_node_group/outputs.tf | 5 +++++ outputs.tf | 2 +- 11 files changed, 31 insertions(+), 1 deletion(-) diff --git a/examples/complete/README.md b/examples/complete/README.md index 6fa1f3e8f3..e8831ada9f 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -94,6 +94,7 @@ No inputs. | [cluster\_status](#output\_cluster\_status) | Status of the EKS cluster. One of `CREATING`, `ACTIVE`, `DELETING`, `FAILED` | | [eks\_managed\_node\_groups](#output\_eks\_managed\_node\_groups) | Map of attribute maps for all EKS managed node groups created | | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index 8a9153c099..0059b252da 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -55,6 +55,11 @@ output "cluster_security_group_arn" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = module.eks.oidc_provider +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = module.eks.oidc_provider_arn diff --git a/examples/eks_managed_node_group/README.md b/examples/eks_managed_node_group/README.md index dad516ec15..61e793615b 100644 --- a/examples/eks_managed_node_group/README.md +++ b/examples/eks_managed_node_group/README.md @@ -127,6 +127,7 @@ No inputs. | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/examples/eks_managed_node_group/outputs.tf b/examples/eks_managed_node_group/outputs.tf index 3e9620157b..c6d9be3bcf 100644 --- a/examples/eks_managed_node_group/outputs.tf +++ b/examples/eks_managed_node_group/outputs.tf @@ -74,6 +74,11 @@ output "node_security_group_id" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = module.eks.oidc_provider +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = module.eks.oidc_provider_arn diff --git a/examples/fargate_profile/README.md b/examples/fargate_profile/README.md index 85bce85ce7..3d58e3a569 100644 --- a/examples/fargate_profile/README.md +++ b/examples/fargate_profile/README.md @@ -71,6 +71,7 @@ No inputs. | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/examples/fargate_profile/outputs.tf b/examples/fargate_profile/outputs.tf index 3e9620157b..c6d9be3bcf 100644 --- a/examples/fargate_profile/outputs.tf +++ b/examples/fargate_profile/outputs.tf @@ -74,6 +74,11 @@ output "node_security_group_id" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = module.eks.oidc_provider +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = module.eks.oidc_provider_arn diff --git a/examples/irsa_autoscale_refresh/README.md b/examples/irsa_autoscale_refresh/README.md index d48a2a8edf..ac65d52e29 100644 --- a/examples/irsa_autoscale_refresh/README.md +++ b/examples/irsa_autoscale_refresh/README.md @@ -97,6 +97,7 @@ No inputs. | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/examples/irsa_autoscale_refresh/outputs.tf b/examples/irsa_autoscale_refresh/outputs.tf index 3e9620157b..c6d9be3bcf 100644 --- a/examples/irsa_autoscale_refresh/outputs.tf +++ b/examples/irsa_autoscale_refresh/outputs.tf @@ -74,6 +74,11 @@ output "node_security_group_id" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = module.eks.oidc_provider +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = module.eks.oidc_provider_arn diff --git a/examples/self_managed_node_group/README.md b/examples/self_managed_node_group/README.md index 8356943906..580854b78f 100644 --- a/examples/self_managed_node_group/README.md +++ b/examples/self_managed_node_group/README.md @@ -91,6 +91,7 @@ No inputs. | [fargate\_profiles](#output\_fargate\_profiles) | Map of attribute maps for all EKS Fargate Profiles created | | [node\_security\_group\_arn](#output\_node\_security\_group\_arn) | Amazon Resource Name (ARN) of the node shared security group | | [node\_security\_group\_id](#output\_node\_security\_group\_id) | ID of the node shared security group | +| [oidc\_provider](#output\_oidc\_provider) | The OpenID Connect identity provider (issuer URL without leading `https://`) | | [oidc\_provider\_arn](#output\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | | [self\_managed\_node\_groups](#output\_self\_managed\_node\_groups) | Map of attribute maps for all self managed node groups created | diff --git a/examples/self_managed_node_group/outputs.tf b/examples/self_managed_node_group/outputs.tf index 3e9620157b..c6d9be3bcf 100644 --- a/examples/self_managed_node_group/outputs.tf +++ b/examples/self_managed_node_group/outputs.tf @@ -74,6 +74,11 @@ output "node_security_group_id" { # IRSA ################################################################################ +output "oidc_provider" { + description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" + value = module.eks.oidc_provider +} + output "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" value = module.eks.oidc_provider_arn diff --git a/outputs.tf b/outputs.tf index 05eaa5c808..e6867b5ce0 100644 --- a/outputs.tf +++ b/outputs.tf @@ -76,7 +76,7 @@ output "node_security_group_id" { output "oidc_provider" { description = "The OpenID Connect identity provider (issuer URL without leading `https://`)" - value = replace(try(aws_eks_cluster.this[0].identity[0].oidc[0].issuer, ""), "https://", "") + value = try(replace(aws_eks_cluster.this[0].identity[0].oidc[0].issuer, "https://", ""), "") } output "oidc_provider_arn" {