Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use resource account #13

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Module that provides the reference architecture.
| [azurerm_role_assignment.humanitec_cluster_admin_permissions](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.humanitec_cluster_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [helm_release.ingress_nginx](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [humanitec_resource_account.cluster_account](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_account) | resource |
| [humanitec_resource_definition.k8s_cluster_driver](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition) | resource |
| [humanitec_resource_definition.k8s_namespace](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition) | resource |
| [humanitec_resource_definition_criteria.k8s_cluster_driver](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |
Expand Down
22 changes: 14 additions & 8 deletions modules/base/humanitec.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
# Humanitec resource definition to connect the cluster to Humanitec

resource "humanitec_resource_account" "cluster_account" {
id = var.cluster_name
name = var.cluster_name
type = "azure"

credentials = jsonencode({
"appId" : azuread_service_principal.humanitec.client_id,
"displayName" : azuread_application.main.display_name,
"password" : azuread_service_principal_password.humanitec.value,
"tenant" : azuread_service_principal.humanitec.application_tenant_id
})
}

resource "humanitec_resource_definition" "k8s_cluster_driver" {
driver_type = "humanitec/k8s-cluster-aks"
id = var.cluster_name
name = var.cluster_name
type = "k8s-cluster"

driver_account = humanitec_resource_account.cluster_account.id
driver_inputs = {
values_string = jsonencode({
"loadbalancer" : azurerm_public_ip.ingress.ip_address
Expand All @@ -14,14 +28,6 @@ resource "humanitec_resource_definition" "k8s_cluster_driver" {
"subscription_id" : var.subscription_id,
"server_app_id" : data.azuread_service_principal.aks.client_id
})
secrets_string = jsonencode({
"credentials" = {
"appId" : azuread_service_principal.humanitec.client_id,
"displayName" : azuread_application.main.display_name,
"password" : azuread_service_principal_password.humanitec.value,
"tenant" : azuread_service_principal.humanitec.application_tenant_id
}
})
}
}

Expand Down
Loading