Skip to content

Commit

Permalink
Terraform FMT
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubertfy committed Jul 12, 2023
1 parent 7943b62 commit be17782
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion acr.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion kv.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion mlfoundry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ 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" {
value = var.create_db == true ? resource.azurerm_private_endpoint.postgresql_private_connection[0].private_service_connection[0].private_ip_address : "dummy"
}

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
}

Expand Down
38 changes: 19 additions & 19 deletions postgres.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
}
}
4 changes: 2 additions & 2 deletions storage.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions svcfoundry.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
42 changes: 21 additions & 21 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ variable "tags" {

variable "cluster_oidc_url" {
description = "OIDC url for the cluster to create federated credential for"
type = string
type = string
}

##### Control Plane Components

#### 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"
}

Expand All @@ -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
}

0 comments on commit be17782

Please sign in to comment.