Skip to content

Commit 19015da

Browse files
authored
Merge pull request terraform-google-modules#346 from paulpalamarchuk/add_var_to_pass_ssh-key_in_acm
Add variable to allow a pre-generated SSH key to be passed to the ACM module
2 parents 45a8e33 + 39e93a6 commit 19015da

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

modules/acm/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ By default, this module will attempt to download the ACM operator from Google di
5353
| operator\_path | Path to the operator yaml config. If unset, will download from GCS releases. | string | `"null"` | no |
5454
| policy\_dir | Subfolder containing configs in ACM Git repo | string | n/a | yes |
5555
| project\_id | The project in which the resource belongs. | string | n/a | yes |
56+
| ssh\_auth\_key | Key for Git authentication. Overrides 'create_ssh_key' variable. Can be set using 'file(path/to/file)'-function. | string | `"null"` | no |
5657
| sync\_branch | ACM repo Git branch | string | `"master"` | no |
5758
| sync\_repo | ACM Git repo address | string | n/a | yes |
5859

modules/acm/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ locals {
1818
cluster_endpoint = "https://${var.cluster_endpoint}"
1919
token = data.google_client_config.default.access_token
2020
cluster_ca_certificate = data.google_container_cluster.primary.master_auth.0.cluster_ca_certificate
21-
private_key = var.create_ssh_key ? tls_private_key.git_creds[0].private_key_pem : ""
21+
private_key = var.create_ssh_key && var.ssh_auth_key == null ? tls_private_key.git_creds[0].private_key_pem : var.ssh_auth_key
2222
download_operator = var.operator_path == null ? true : false
2323
operator_path = local.download_operator ? "${path.module}/config-management-operator.yaml" : var.operator_path
2424
}

modules/acm/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ variable "create_ssh_key" {
6262
default = true
6363
}
6464

65+
variable "ssh_auth_key" {
66+
description = "Key for Git authentication. Overrides 'create_ssh_key' variable. Can be set using 'file(path/to/file)'-function."
67+
type = string
68+
default = null
69+
}
70+
6571
variable "enable_policy_controller" {
6672
description = "Whether to enable the ACM Policy Controller on the cluster"
6773
type = bool

0 commit comments

Comments
 (0)