From 1b392434433827c1208ac78e7d30dd44cf94de76 Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Mon, 18 Nov 2024 12:40:45 +0100 Subject: [PATCH 1/4] Update platform outputs --- cluster_integration.tf | 8 ++++---- container.tf | 4 ++-- output.tf | 14 ++++++++++++++ variables.tf | 6 ------ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/cluster_integration.tf b/cluster_integration.tf index 32d3919..1deb482 100644 --- a/cluster_integration.tf +++ b/cluster_integration.tf @@ -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 diff --git a/container.tf b/container.tf index 73853d3..bffe14d 100644 --- a/container.tf +++ b/container.tf @@ -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 @@ -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 } diff --git a/output.tf b/output.tf index c3f1f21..5911d4d 100644 --- a/output.tf +++ b/output.tf @@ -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 : "" @@ -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" @@ -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" diff --git a/variables.tf b/variables.tf index 66bc876..dbf0e4b 100644 --- a/variables.tf +++ b/variables.tf @@ -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 ################################################################################ From 72a939a90edb811a72a039eb4f9222269dcc569f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Nov 2024 11:41:52 +0000 Subject: [PATCH 2/4] terraform-docs: automated action --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 656ea3f..0aa96f3 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,6 @@ No modules. | [feature\_cluster\_integration\_enabled](#input\_feature\_cluster\_integration\_enabled) | Enable the support of cluster integration | `bool` | `true` | no | | [feature\_container\_registry\_enabled](#input\_feature\_container\_registry\_enabled) | Enable docker registry feature in the platform | `bool` | `true` | no | | [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 | -| [platform\_feature\_enabled](#input\_platform\_feature\_enabled) | Enable platform features like container registry and storage account | `bool` | `true` | no | | [resource\_group\_name](#input\_resource\_group\_name) | Name of the resource group | `string` | n/a | yes | | [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no | @@ -71,6 +70,7 @@ No modules. | Name | Description | |------|-------------| | [truefoundry\_blob\_container\_id](#output\_truefoundry\_blob\_container\_id) | Storage account container ID | +| [truefoundry\_blob\_storage\_account\_enabled](#output\_truefoundry\_blob\_storage\_account\_enabled) | Flag to enable blob storage account | | [truefoundry\_blob\_storage\_account\_id](#output\_truefoundry\_blob\_storage\_account\_id) | Storage account id | | [truefoundry\_blob\_storage\_account\_primary\_blob\_host](#output\_truefoundry\_blob\_storage\_account\_primary\_blob\_host) | Storage account primary blob host | | [truefoundry\_blob\_storage\_account\_primary\_connection\_string](#output\_truefoundry\_blob\_storage\_account\_primary\_connection\_string) | Storage account primary connection string | @@ -80,11 +80,13 @@ No modules. | [truefoundry\_cluster\_integrations\_azuread\_application\_client\_id](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_client\_id) | Azure AD application client ID | | [truefoundry\_cluster\_integrations\_azuread\_application\_id](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_id) | Azure AD application ID | | [truefoundry\_cluster\_integrations\_azuread\_application\_name](#output\_truefoundry\_cluster\_integrations\_azuread\_application\_name) | n/a | +| [truefoundry\_cluster\_integrations\_enabled](#output\_truefoundry\_cluster\_integrations\_enabled) | Flag to enable cluster integrations | | [truefoundry\_cluster\_integrations\_service\_principal\_name](#output\_truefoundry\_cluster\_integrations\_service\_principal\_name) | n/a | | [truefoundry\_cluster\_integrations\_service\_principal\_password](#output\_truefoundry\_cluster\_integrations\_service\_principal\_password) | n/a | | [truefoundry\_cluster\_integrations\_service\_principal\_tenant\_id](#output\_truefoundry\_cluster\_integrations\_service\_principal\_tenant\_id) | n/a | | [truefoundry\_container\_registry\_admin\_password](#output\_truefoundry\_container\_registry\_admin\_password) | Container registry admin password | | [truefoundry\_container\_registry\_admin\_username](#output\_truefoundry\_container\_registry\_admin\_username) | Container registry admin username | +| [truefoundry\_container\_registry\_enabled](#output\_truefoundry\_container\_registry\_enabled) | Flag to enable container registry | | [truefoundry\_container\_registry\_id](#output\_truefoundry\_container\_registry\_id) | Container registry ID | | [truefoundry\_container\_registry\_login\_server](#output\_truefoundry\_container\_registry\_login\_server) | Container registry login server url | \ No newline at end of file From 29e66b8aface769e7d8af751f80ef7a11728a903 Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Mon, 18 Nov 2024 12:42:02 +0100 Subject: [PATCH 3/4] format output --- output.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output.tf b/output.tf index 5911d4d..b401869 100644 --- a/output.tf +++ b/output.tf @@ -2,7 +2,7 @@ ## Blob Storage ################################################################################## output "truefoundry_blob_storage_account_enabled" { - value = var.feature_blob_storage_enabled + value = var.feature_blob_storage_enabled description = "Flag to enable blob storage account" } @@ -47,7 +47,7 @@ output "truefoundry_blob_storage_root_url" { ################################################################################## output "truefoundry_container_registry_enabled" { - value = var.feature_container_registry_enabled + value = var.feature_container_registry_enabled description = "Flag to enable container registry" } @@ -77,7 +77,7 @@ output "truefoundry_container_registry_admin_password" { ################################################################################## output "truefoundry_cluster_integrations_enabled" { - value = var.feature_cluster_integration_enabled + value = var.feature_cluster_integration_enabled description = "Flag to enable cluster integrations" } From 11526ca69ef3b7b477a5a99e7628e67a615a3f01 Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Mon, 18 Nov 2024 15:14:21 +0100 Subject: [PATCH 4/4] update terraform-docs-generator workflow --- .github/workflows/terraform-docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform-docs.yaml b/.github/workflows/terraform-docs.yaml index 1c9aab4..0ece9d9 100644 --- a/.github/workflows/terraform-docs.yaml +++ b/.github/workflows/terraform-docs.yaml @@ -5,6 +5,6 @@ on: jobs: terraform-docs-generator: name: Generate terraform docs - uses: truefoundry/github-workflows-public/.github/workflows/terraform-doc-generator.yml@v0.1.1 + uses: truefoundry/github-workflows-public/.github/workflows/terraform-doc-generator.yml@v0.1.5 with: - commit_ref: ${{ github.event.pull_request.head.ref }} \ No newline at end of file + commit_ref: ${{ github.event.pull_request.head.ref }}