Skip to content

Commit

Permalink
Merge pull request #8 from truefoundry/update-platform-outputs
Browse files Browse the repository at this point in the history
Update platform outputs
  • Loading branch information
DeeAjayi authored Nov 18, 2024
2 parents 0ccc8ee + 11526ca commit 4cd1c3e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ on:
jobs:
terraform-docs-generator:
name: Generate terraform docs
uses: truefoundry/github-workflows-public/.github/workflows/[email protected].1
uses: truefoundry/github-workflows-public/.github/workflows/[email protected].5
with:
commit_ref: ${{ github.event.pull_request.head.ref }}
commit_ref: ${{ github.event.pull_request.head.ref }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ No modules.
| <a name="input_feature_cluster_integration_enabled"></a> [feature\_cluster\_integration\_enabled](#input\_feature\_cluster\_integration\_enabled) | Enable the support of cluster integration | `bool` | `true` | no |
| <a name="input_feature_container_registry_enabled"></a> [feature\_container\_registry\_enabled](#input\_feature\_container\_registry\_enabled) | Enable docker registry feature in the platform | `bool` | `true` | no |
| <a name="input_location"></a> [location](#input\_location) | Location of the storage account and container registry. This should be kept similar to resource group for ideal performance. | `string` | n/a | yes |
| <a name="input_platform_feature_enabled"></a> [platform\_feature\_enabled](#input\_platform\_feature\_enabled) | Enable platform features like container registry and storage account | `bool` | `true` | no |
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | Name of the resource group | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |

Expand All @@ -71,6 +70,7 @@ No modules.
| Name | Description |
|------|-------------|
| <a name="output_truefoundry_blob_container_id"></a> [truefoundry\_blob\_container\_id](#output\_truefoundry\_blob\_container\_id) | Storage account container ID |
| <a name="output_truefoundry_blob_storage_account_enabled"></a> [truefoundry\_blob\_storage\_account\_enabled](#output\_truefoundry\_blob\_storage\_account\_enabled) | Flag to enable blob storage account |
| <a name="output_truefoundry_blob_storage_account_id"></a> [truefoundry\_blob\_storage\_account\_id](#output\_truefoundry\_blob\_storage\_account\_id) | Storage account id |
| <a name="output_truefoundry_blob_storage_account_primary_blob_host"></a> [truefoundry\_blob\_storage\_account\_primary\_blob\_host](#output\_truefoundry\_blob\_storage\_account\_primary\_blob\_host) | Storage account primary blob host |
| <a name="output_truefoundry_blob_storage_account_primary_connection_string"></a> [truefoundry\_blob\_storage\_account\_primary\_connection\_string](#output\_truefoundry\_blob\_storage\_account\_primary\_connection\_string) | Storage account primary connection string |
Expand All @@ -80,11 +80,13 @@ No modules.
| <a name="output_truefoundry_cluster_integrations_azuread_application_client_id"></a> [truefoundry\_cluster\_integrations\_azuread\_application\_client\_id](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_client\_id) | Azure AD application client ID |
| <a name="output_truefoundry_cluster_integrations_azuread_application_id"></a> [truefoundry\_cluster\_integrations\_azuread\_application\_id](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_id) | Azure AD application ID |
| <a name="output_truefoundry_cluster_integrations_azuread_application_name"></a> [truefoundry\_cluster\_integrations\_azuread\_application\_name](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_name) | n/a |
| <a name="output_truefoundry_cluster_integrations_enabled"></a> [truefoundry\_cluster\_integrations\_enabled](#output\_truefoundry\_cluster\_integrations\_enabled) | Flag to enable cluster integrations |
| <a name="output_truefoundry_cluster_integrations_service_principal_name"></a> [truefoundry\_cluster\_integrations\_service\_principal\_name](#output\_truefoundry\_cluster\_integrations\_service\_principal\_name) | n/a |
| <a name="output_truefoundry_cluster_integrations_service_principal_password"></a> [truefoundry\_cluster\_integrations\_service\_principal\_password](#output\_truefoundry\_cluster\_integrations\_service\_principal\_password) | n/a |
| <a name="output_truefoundry_cluster_integrations_service_principal_tenant_id"></a> [truefoundry\_cluster\_integrations\_service\_principal\_tenant\_id](#output\_truefoundry\_cluster\_integrations\_service\_principal\_tenant\_id) | n/a |
| <a name="output_truefoundry_container_registry_admin_password"></a> [truefoundry\_container\_registry\_admin\_password](#output\_truefoundry\_container\_registry\_admin\_password) | Container registry admin password |
| <a name="output_truefoundry_container_registry_admin_username"></a> [truefoundry\_container\_registry\_admin\_username](#output\_truefoundry\_container\_registry\_admin\_username) | Container registry admin username |
| <a name="output_truefoundry_container_registry_enabled"></a> [truefoundry\_container\_registry\_enabled](#output\_truefoundry\_container\_registry\_enabled) | Flag to enable container registry |
| <a name="output_truefoundry_container_registry_id"></a> [truefoundry\_container\_registry\_id](#output\_truefoundry\_container\_registry\_id) | Container registry ID |
| <a name="output_truefoundry_container_registry_login_server"></a> [truefoundry\_container\_registry\_login\_server](#output\_truefoundry\_container\_registry\_login\_server) | Container registry login server url |
<!-- END_TF_DOCS -->
8 changes: 4 additions & 4 deletions cluster_integration.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
resource "azuread_application" "truefoundry_platform_features_application" {
count = var.platform_feature_enabled ? var.feature_cluster_integration_enabled ? 1 : 0 : 0
count = var.feature_cluster_integration_enabled ? 1 : 0
display_name = local.azuread_application
sign_in_audience = var.cluster_integration_sign_in_audience
}

resource "azuread_service_principal" "truefoundry_platform_features_service_principal" {
count = var.platform_feature_enabled ? var.feature_cluster_integration_enabled ? 1 : 0 : 0
count = var.feature_cluster_integration_enabled ? 1 : 0
client_id = azuread_application.truefoundry_platform_features_application[0].client_id
}

resource "azuread_service_principal_password" "truefoundry_platform_features_service_principal_password" {
count = var.platform_feature_enabled ? var.feature_cluster_integration_enabled ? 1 : 0 : 0
count = var.feature_cluster_integration_enabled ? 1 : 0
service_principal_id = azuread_service_principal.truefoundry_platform_features_service_principal[0].id
display_name = local.service_principal_password
end_date = var.cluster_integration_service_principal_password_expiry_end_date
}

resource "azurerm_role_assignment" "truefoundry_reader_role_assignment" {
count = var.platform_feature_enabled ? var.feature_cluster_integration_enabled ? 1 : 0 : 0
count = var.feature_cluster_integration_enabled ? 1 : 0
scope = var.cluster_id
role_definition_name = var.cluster_integration_service_principal_role
principal_id = azuread_service_principal.truefoundry_platform_features_service_principal[0].object_id
Expand Down
4 changes: 2 additions & 2 deletions container.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_storage_account" "truefoundry_platform_storage_account" {
count = var.platform_feature_enabled ? var.feature_blob_storage_enabled ? 1 : 0 : 0
count = var.feature_blob_storage_enabled ? 1 : 0
name = local.storage_account_name
resource_group_name = var.resource_group_name
location = var.location
Expand Down Expand Up @@ -27,7 +27,7 @@ resource "azurerm_storage_account" "truefoundry_platform_storage_account" {
}

resource "azurerm_storage_container" "truefoundry_platform_container" {
count = var.platform_feature_enabled ? var.feature_blob_storage_enabled ? 1 : 0 : 0
count = var.feature_blob_storage_enabled ? 1 : 0
name = local.container_name
storage_account_name = azurerm_storage_account.truefoundry_platform_storage_account[0].name
}
14 changes: 14 additions & 0 deletions output.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
##################################################################################
## Blob Storage
##################################################################################
output "truefoundry_blob_storage_account_enabled" {
value = var.feature_blob_storage_enabled
description = "Flag to enable blob storage account"
}

output "truefoundry_blob_storage_account_id" {
value = var.feature_blob_storage_enabled ? azurerm_storage_account.truefoundry_platform_storage_account[0].id : ""
Expand Down Expand Up @@ -42,6 +46,11 @@ output "truefoundry_blob_storage_root_url" {
## Container registry
##################################################################################

output "truefoundry_container_registry_enabled" {
value = var.feature_container_registry_enabled
description = "Flag to enable container registry"
}

output "truefoundry_container_registry_id" {
value = var.feature_container_registry_enabled ? azurerm_container_registry.truefoundry_container_registry[0].id : ""
description = "Container registry ID"
Expand All @@ -67,6 +76,11 @@ output "truefoundry_container_registry_admin_password" {
## Cluster Integrations
##################################################################################

output "truefoundry_cluster_integrations_enabled" {
value = var.feature_cluster_integration_enabled
description = "Flag to enable cluster integrations"
}

output "truefoundry_cluster_integrations_azuread_application_id" {
value = var.feature_cluster_integration_enabled ? azuread_application.truefoundry_platform_features_application[0].id : ""
description = "Azure AD application ID"
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ variable "location" {
type = string
}

variable "platform_feature_enabled" {
description = "Enable platform features like container registry and storage account"
type = bool
default = true
}

################################################################################
# Cluster
################################################################################
Expand Down

0 comments on commit 4cd1c3e

Please sign in to comment.