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

Add diagnostic settings role to service principal #13

Merged
merged 2 commits into from
Jan 8, 2025
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ No modules.
| [azuread_service_principal.truefoundry_platform_features_service_principal](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal) | resource |
| [azuread_service_principal_password.truefoundry_platform_features_service_principal_password](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal_password) | resource |
| [azurerm_container_registry.truefoundry_container_registry](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/container_registry) | resource |
| [azurerm_role_assignment.truefoundry_diagnostic_settings_read_role_assignment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.truefoundry_reader_role_assignment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_storage_account.truefoundry_platform_storage_account](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account) | resource |
| [azurerm_storage_container.truefoundry_platform_container](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container) | resource |
Expand All @@ -49,6 +50,7 @@ No modules.
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | ID of the AKS cluster | `string` | n/a | yes |
| <a name="input_cluster_integration_azuread_application_enable_override"></a> [cluster\_integration\_azuread\_application\_enable\_override](#input\_cluster\_integration\_azuread\_application\_enable\_override) | Enable overriding the name of azuread application. This will only be used if feature\_cluster\_integration\_azuread\_application\_enabled is true. You need to pass cluster\_integration\_azuread\_application\_override\_name to pass the azuread application name | `bool` | `false` | no |
| <a name="input_cluster_integration_azuread_application_override_name"></a> [cluster\_integration\_azuread\_application\_override\_name](#input\_cluster\_integration\_azuread\_application\_override\_name) | Azuread application name. Only used if cluster\_integration\_azuread\_application\_enable\_override is true | `string` | `""` | no |
| <a name="input_cluster_integration_diagnostic_settings_role"></a> [cluster\_integration\_diagnostic\_settings\_role](#input\_cluster\_integration\_diagnostic\_settings\_role) | Role that will be assigned to the service principal on AKS cluster for diagnostic settings | `string` | `"Monitoring Reader"` | no |
| <a name="input_cluster_integration_service_principal_password_expiry_end_date"></a> [cluster\_integration\_service\_principal\_password\_expiry\_end\_date](#input\_cluster\_integration\_service\_principal\_password\_expiry\_end\_date) | End date post which service principal password would expire | `string` | `"2124-02-12T09:42:53Z"` | no |
| <a name="input_cluster_integration_service_principal_role"></a> [cluster\_integration\_service\_principal\_role](#input\_cluster\_integration\_service\_principal\_role) | Role that will be assigned to the service principal on AKS cluster | `string` | `"Reader"` | no |
| <a name="input_cluster_integration_sign_in_audience"></a> [cluster\_integration\_sign\_in\_audience](#input\_cluster\_integration\_sign\_in\_audience) | sign\_in\_audience of the cluster integration | `string` | `"AzureADMyOrg"` | no |
Expand Down
8 changes: 8 additions & 0 deletions cluster_integration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ resource "azurerm_role_assignment" "truefoundry_reader_role_assignment" {
role_definition_name = var.cluster_integration_service_principal_role
principal_id = azuread_service_principal.truefoundry_platform_features_service_principal[0].object_id
}


resource "azurerm_role_assignment" "truefoundry_diagnostic_settings_read_role_assignment" {
count = var.feature_cluster_integration_enabled ? 1 : 0
scope = var.cluster_id
role_definition_name = var.cluster_integration_diagnostic_settings_role
principal_id = azuread_service_principal.truefoundry_platform_features_service_principal[0].object_id
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ variable "cluster_integration_service_principal_role" {
default = "Reader"
}

variable "cluster_integration_diagnostic_settings_role" {
description = "Role that will be assigned to the service principal on AKS cluster for diagnostic settings"
type = string
default = "Monitoring Reader"
}

##################################################################################
## Other variables
##################################################################################
Expand Down