Skip to content

Commit c213357

Browse files
feat: use resource account (#23)
1 parent ee1ffa8 commit c213357

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

modules/gke/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ output "zone" {
2121
}
2222

2323
output "credentials" {
24-
value = jsondecode(base64decode(google_service_account_key.gke_cluster_access_key.private_key))
24+
value = base64decode(google_service_account_key.gke_cluster_access_key.private_key)
2525
sensitive = true
2626
}
2727

modules/htc_res_defs/main.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
resource "humanitec_resource_account" "cluster_account" {
2+
id = "${var.prefix}cluster"
3+
name = "${var.prefix}cluster"
4+
type = "gcp"
5+
6+
credentials = var.k8s_credentials
7+
}
8+
19
resource "humanitec_resource_definition" "k8s_cluster" {
210
driver_type = "humanitec/k8s-cluster-gke"
311
id = "${var.prefix}cluster"
412
name = "${var.prefix}cluster"
513
type = "k8s-cluster"
614

15+
driver_account = humanitec_resource_account.cluster_account.id
716
driver_inputs = {
817
values_string = jsonencode({
918
"name" = var.k8s_cluster_name
1019
"loadbalancer" = var.k8s_loadbalancer
1120
"project_id" = var.k8s_project_id
1221
"zone" = var.k8s_region
13-
}),
14-
secrets_string = jsonencode({
15-
"credentials" = var.k8s_credentials
1622
})
1723
}
1824
}

modules/htc_res_defs/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ variable "k8s_region" {
1616
description = "The region the cluster is in."
1717
}
1818
variable "k8s_credentials" {
19-
type = map(any)
19+
type = string
2020
description = "The credentials used to establish a connection to the cluster."
2121
}
2222
variable "environment" {
@@ -31,4 +31,4 @@ variable "prefix" {
3131
type = string
3232
description = "A prefix that will be attached to all IDs created in Humanitec."
3333
default = ""
34-
}
34+
}

0 commit comments

Comments
 (0)