From be17782c65c69afc2c0013847711700417dd376f Mon Sep 17 00:00:00 2001 From: Ubertfy Date: Wed, 12 Jul 2023 13:14:16 +0200 Subject: [PATCH] Terraform FMT --- acr.tf | 2 +- kv.tf | 2 +- locals.tf | 6 +++--- mlfoundry.tf | 2 +- outputs.tf | 4 ++-- postgres.tf | 38 +++++++++++++++++++------------------- storage.tf | 4 ++-- svcfoundry.tf | 4 ++-- variables.tf | 42 +++++++++++++++++++++--------------------- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/acr.tf b/acr.tf index 7c73d53..fc781ea 100644 --- a/acr.tf +++ b/acr.tf @@ -1,5 +1,5 @@ resource "azurerm_container_registry" "svcfoundry" { - count = var.create_acr == true ? 1 : 0 + count = var.create_acr == true ? 1 : 0 name = local.svcfoundry_unique_name resource_group_name = var.resource_group_name location = var.location diff --git a/kv.tf b/kv.tf index b505aac..303a405 100644 --- a/kv.tf +++ b/kv.tf @@ -1,7 +1,7 @@ data "azurerm_client_config" "current" {} resource "azurerm_key_vault" "akv_svcfoundry" { - count = var.create_kv == true ? 1 : 0 + count = var.create_kv == true ? 1 : 0 name = "tfy-svcfoundry" location = var.location resource_group_name = var.resource_group_name diff --git a/locals.tf b/locals.tf index b182b5b..a20b482 100644 --- a/locals.tf +++ b/locals.tf @@ -1,8 +1,8 @@ locals { - truefoundry_unique_name = substr(replace("${var.unique_name}", "-", ""), 0, 20) - svcfoundry_unique_name = substr(replace("svc-${var.unique_name}", "-", ""), 0, 20) - mlfoundry_unique_name = substr(replace("mlf-${var.unique_name}", "-", ""), 0, 20) + truefoundry_unique_name = substr(replace("${var.unique_name}", "-", ""), 0, 20) + svcfoundry_unique_name = substr(replace("svc-${var.unique_name}", "-", ""), 0, 20) + mlfoundry_unique_name = substr(replace("mlf-${var.unique_name}", "-", ""), 0, 20) truefoundry_db_port = 5432 truefoundry_db_master_username = "truefoundry_root" diff --git a/mlfoundry.tf b/mlfoundry.tf index 64047da..ecf3cf5 100644 --- a/mlfoundry.tf +++ b/mlfoundry.tf @@ -1,5 +1,5 @@ resource "azurerm_role_assignment" "mlfoundry" { - count = var.create_blob_storage == true ? 1 : 0 + count = var.create_blob_storage == true ? 1 : 0 scope = azurerm_storage_container.truefoundry[0].resource_manager_id role_definition_name = "Storage Blob Data Contributor" principal_id = azurerm_user_assigned_identity.mlfoundry.principal_id diff --git a/outputs.tf b/outputs.tf index 83f41c0..a8d896a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,7 +3,7 @@ output "truefoundry_db_name" { } output "truefoundry_db_endpoint" { - value = var.create_db == true ? module.postgresql-db[0].server_fqdn: "dummy" + value = var.create_db == true ? module.postgresql-db[0].server_fqdn : "dummy" } output "truefoundry_db_private_ip" { @@ -11,7 +11,7 @@ output "truefoundry_db_private_ip" { } output "truefoundry_db_password" { - value = var.create_db == true ? module.postgresql-db[0].administrator_password: "dummy" + value = var.create_db == true ? module.postgresql-db[0].administrator_password : "dummy" sensitive = true } diff --git a/postgres.tf b/postgres.tf index 223dad6..72b51e5 100644 --- a/postgres.tf +++ b/postgres.tf @@ -5,28 +5,28 @@ resource "random_password" "truefoundry_db_password" { } module "postgresql-db" { - count = var.create_db == true ? 1 : 0 - source = "Azure/postgresql/azurerm" - version = "3.0.0" - server_name = var.truefoundry_db_enable_override ? var.truefoundry_db_override_name : "${var.unique_name}-db" - sku_name = var.truefoundry_db_instance_class - location = var.location - resource_group_name = var.resource_group_name - storage_mb = var.truefoundry_db_allocated_storage - backup_retention_days = 7 - geo_redundant_backup_enabled = false - administrator_login = local.truefoundry_db_master_username - administrator_password = random_password.truefoundry_db_password.result - server_version = "11" - ssl_enforcement_enabled = false + count = var.create_db == true ? 1 : 0 + source = "Azure/postgresql/azurerm" + version = "3.0.0" + server_name = var.truefoundry_db_enable_override ? var.truefoundry_db_override_name : "${var.unique_name}-db" + sku_name = var.truefoundry_db_instance_class + location = var.location + resource_group_name = var.resource_group_name + storage_mb = var.truefoundry_db_allocated_storage + backup_retention_days = 7 + geo_redundant_backup_enabled = false + administrator_login = local.truefoundry_db_master_username + administrator_password = random_password.truefoundry_db_password.result + server_version = "11" + ssl_enforcement_enabled = false ssl_minimal_tls_version_enforced = "TLSEnforcementDisabled" - db_names = ["truefoundry"] - tags = local.tags - public_network_access_enabled = false + db_names = ["truefoundry"] + tags = local.tags + public_network_access_enabled = false } resource "azurerm_private_endpoint" "postgresql_private_connection" { - count = var.create_db == true ? 1 : 0 + count = var.create_db == true ? 1 : 0 name = "${var.unique_name}-db-private-endpoint" location = var.location resource_group_name = var.resource_group_name @@ -36,6 +36,6 @@ resource "azurerm_private_endpoint" "postgresql_private_connection" { name = "${var.unique_name}-db-private-connection" private_connection_resource_id = module.postgresql-db[0].server_id is_manual_connection = false - subresource_names = [ "postgresqlServer" ] + subresource_names = ["postgresqlServer"] } } diff --git a/storage.tf b/storage.tf index cb97267..d4d1565 100644 --- a/storage.tf +++ b/storage.tf @@ -1,5 +1,5 @@ resource "azurerm_storage_account" "this" { - count = var.create_blob_storage == true ? 1 : 0 + count = var.create_blob_storage == true ? 1 : 0 name = replace(local.truefoundry_unique_name, "-", "") resource_group_name = var.resource_group_name location = var.location @@ -10,7 +10,7 @@ resource "azurerm_storage_account" "this" { } resource "azurerm_storage_container" "truefoundry" { - count = var.create_blob_storage == true ? 1 : 0 + count = var.create_blob_storage == true ? 1 : 0 name = local.truefoundry_unique_name storage_account_name = azurerm_storage_account.this[0].name container_access_type = "blob" diff --git a/svcfoundry.tf b/svcfoundry.tf index f35de7b..df50173 100644 --- a/svcfoundry.tf +++ b/svcfoundry.tf @@ -1,12 +1,12 @@ resource "azurerm_role_assignment" "storage_svcfoundry" { - count = var.create_blob_storage == true ? 1 : 0 + count = var.create_blob_storage == true ? 1 : 0 scope = azurerm_storage_container.truefoundry[0].resource_manager_id role_definition_name = "Storage Blob Data Contributor" principal_id = azurerm_user_assigned_identity.svcfoundry.principal_id } resource "azurerm_role_assignment" "acr_svcfoundry" { - count = var.create_acr == true ? 1 : 0 + count = var.create_acr == true ? 1 : 0 scope = azurerm_container_registry.svcfoundry[0].id role_definition_name = "Contributor" principal_id = azurerm_user_assigned_identity.svcfoundry.principal_id diff --git a/variables.tf b/variables.tf index 7da11fe..46f090d 100644 --- a/variables.tf +++ b/variables.tf @@ -29,7 +29,7 @@ variable "tags" { variable "cluster_oidc_url" { description = "OIDC url for the cluster to create federated credential for" - type = string + type = string } ##### Control Plane Components @@ -37,19 +37,19 @@ variable "cluster_oidc_url" { #### Database variable "create_db" { - type = bool + type = bool description = "Create db" - default = false + default = false } variable "truefoundry_db_enable_override" { - type = bool + type = bool description = "Truefoundry db name override to be enabled" - default = false + default = false } variable "truefoundry_db_override_name" { - type = string + type = string description = "Truefoundry db name override" } @@ -64,58 +64,58 @@ variable "truefoundry_db_allocated_storage" { } variable "truefoundry_db_subnet_id" { - type = string + type = string description = "ID of the subnet which the db should use" } #### Azure Container Repository variable "create_acr" { - type = bool + type = bool description = "Create acr" - default = false + default = false } #### Azure KeyVault variable "create_kv" { - type = bool + type = bool description = "Create kv" - default = false + default = false } #### Azure Storage variable "create_blob_storage" { - type = bool + type = bool description = "Create blob storage" - default = false + default = false } ###### mlfoundry variable "mlfoundry_svc_acc" { description = "Name of the mlfoundry service account" - default = "mlfoundry-server" - type = string + default = "mlfoundry-server" + type = string } variable "mlfoundry_namespace" { description = "Name of the mlfoundry namespace" - default = "truefoundry" - type = string + default = "truefoundry" + type = string } ###### svcfoundry variable "svcfoundry_svc_acc" { description = "Name of the svcfoundry service account" - default = "servicefoundry-server" - type = string + default = "servicefoundry-server" + type = string } variable "svcfoundry_namespace" { description = "Name of the svcfoundry namespace" - default = "truefoundry" - type = string + default = "truefoundry" + type = string }