Skip to content

Commit 48e1fee

Browse files
dansivitermorgante
andauthored
fix: Chain GOOGLE_CREDENTIALS variable on kubectl-wrapper submodule (#95)
* Addresses #93 * Correcting docs Co-authored-by: Morgante Pell <morgantep@google.com>
1 parent 6037c26 commit 48e1fee

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Setting it to `never` will *never* gcloud download and setting it to `always` wi
5858
| service\_account\_key\_file | Path to service account key file to run `gcloud auth activate-service-account` with. Optional. | `string` | `""` | no |
5959
| skip\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | `bool` | `true` | no |
6060
| upgrade | Whether to upgrade gcloud at runtime | `bool` | `true` | no |
61-
| use\_tf\_google\_credentials\_env\_var | Use GOOGLE\_CREDENTIALS environment variable to run `gcloud auth activate-service-account` with. Optional. | `bool` | `false` | no |
61+
| use\_tf\_google\_credentials\_env\_var | Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional. | `bool` | `false` | no |
6262

6363
## Outputs
6464

modules/kubectl-wrapper/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module "kubectl" {
4141
| skip\_download | Whether to skip downloading gcloud (assumes gcloud and kubectl is already available outside the module) | `bool` | `true` | no |
4242
| upgrade | Whether to upgrade gcloud at runtime | `bool` | `true` | no |
4343
| use\_existing\_context | Use existing kubecontext to auth kube-api. | `bool` | `false` | no |
44+
| use\_tf\_google\_credentials\_env\_var | Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional. | `bool` | `false` | no |
4445

4546
## Outputs
4647

modules/kubectl-wrapper/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ locals {
1919
}
2020

2121
module "gcloud_kubectl" {
22-
source = "../.."
23-
module_depends_on = var.module_depends_on
24-
additional_components = var.additional_components
25-
skip_download = var.skip_download
26-
gcloud_sdk_version = var.gcloud_sdk_version
27-
enabled = var.enabled
28-
upgrade = var.upgrade
29-
service_account_key_file = var.service_account_key_file
22+
source = "../.."
23+
module_depends_on = var.module_depends_on
24+
additional_components = var.additional_components
25+
skip_download = var.skip_download
26+
gcloud_sdk_version = var.gcloud_sdk_version
27+
enabled = var.enabled
28+
upgrade = var.upgrade
29+
service_account_key_file = var.service_account_key_file
30+
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
3031

3132
create_cmd_entrypoint = "${path.module}/scripts/kubectl_wrapper.sh"
3233
create_cmd_body = var.impersonate_service_account == "" ? "${local.base_cmd} ${var.kubectl_create_command}" : "${local.base_cmd} true ${var.impersonate_service_account} ${var.kubectl_create_command}"

modules/kubectl-wrapper/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ variable "service_account_key_file" {
9999
default = ""
100100
}
101101

102+
variable "use_tf_google_credentials_env_var" {
103+
description = "Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional."
104+
default = false
105+
}
106+
102107
variable "impersonate_service_account" {
103108
type = string
104109
description = "An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials."

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ variable "service_account_key_file" {
8080
}
8181

8282
variable "use_tf_google_credentials_env_var" {
83-
description = "Use GOOGLE_CREDENTIALS environment variable to run `gcloud auth activate-service-account` with. Optional."
83+
description = "Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional."
8484
default = false
8585
}
8686

0 commit comments

Comments
 (0)