Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwd9000-ML committed Jan 17, 2024
1 parent d3be512 commit 19a2a32
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 22 deletions.
3 changes: 1 addition & 2 deletions 02_networking.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ resource "azurerm_virtual_network" "az_openai_vnet" {

# Azure Virtual Network Subnets
resource "azurerm_subnet" "az_openai_subnet" {
for_each = { for each in var.subnet_config : each.subnet_name => each }

for_each = var.subnet_config
resource_group_name = azurerm_resource_group.az_openai_rg.name
virtual_network_name = azurerm_virtual_network.az_openai_vnet.name
name = each.value.subnet_name
Expand Down
75 changes: 75 additions & 0 deletions 04_az_openai.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# resource "azurerm_cognitive_account" "az_openai" {
# kind = "OpenAI"
# location = var.location
# name = var.account_name
# resource_group_name = var.resource_group_name
# sku_name = var.sku_name
# custom_subdomain_name = var.custom_subdomain_name
# dynamic_throttling_enabled = var.dynamic_throttling_enabled
# fqdns = var.fqdns
# local_auth_enabled = var.local_auth_enabled
# outbound_network_access_restricted = var.outbound_network_access_restricted
# public_network_access_enabled = var.public_network_access_enabled
# tags = var.tags

# dynamic "customer_managed_key" {
# for_each = var.customer_managed_key != null ? [var.customer_managed_key] : []
# content {
# key_vault_key_id = customer_managed_key.value.key_vault_key_id
# identity_client_id = customer_managed_key.value.identity_client_id
# }
# }

# dynamic "identity" {
# for_each = var.identity != null ? [var.identity] : []
# content {
# type = identity.value.type
# identity_ids = identity.value.identity_ids
# }
# }

# dynamic "network_acls" {
# for_each = var.network_acls != null ? [var.network_acls] : []
# content {
# default_action = network_acls.value.default_action
# ip_rules = network_acls.value.ip_rules

# dynamic "virtual_network_rules" {
# for_each = network_acls.value.virtual_network_rules != null ? network_acls.value.virtual_network_rules : []
# content {
# subnet_id = virtual_network_rules.value.subnet_id
# ignore_missing_vnet_service_endpoint = virtual_network_rules.value.ignore_missing_vnet_service_endpoint
# }
# }
# }
# }

# dynamic "storage" {
# for_each = var.storage
# content {
# storage_account_id = storage.value.storage_account_id
# identity_client_id = storage.value.identity_client_id
# }
# }
# }

# resource "azurerm_cognitive_deployment" "az_openai_models" {
# for_each = { for each in var.model_deployment : each.deployment_id => each }

# cognitive_account_id = data.azurerm_cognitive_account.openai.id
# name = each.value.deployment_id
# rai_policy_name = each.value.rai_policy_name

# model {
# format = each.value.model_format
# name = each.value.model_name
# version = each.value.model_version
# }
# scale {
# type = each.value.scale_type
# tier = each.value.scale_tier
# size = each.value.scale_size
# family = each.value.scale_family
# capacity = each.value.scale_capacity
# }
# }
7 changes: 7 additions & 0 deletions tests/auto_test1/data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
data "azurerm_subnet" "subnet" {
for_each = var.subnet_config
name = each.value.subnet_name
virtual_network_name = var.virtual_network_name
resource_group_name = var.resource_group_name
}

# data "azurerm_key_vault" "gpt" {
# name = local.kv_config.name
# resource_group_name = azurerm_resource_group.rg.name
Expand Down
16 changes: 6 additions & 10 deletions tests/auto_test1/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,14 @@ module "private-chatgpt-openai" {
subnet_config = var.subnet_config

#03 keyvault (Solution Secrets)
kv_name = var.kv_name
kv_sku = var.kv_sku

kv_name = var.kv_name
kv_sku = var.kv_sku
keyvault_firewall_default_action = var.keyvault_firewall_default_action
keyvault_firewall_bypass = var.keyvault_firewall_bypass
keyvault_firewall_allowed_ips = var.keyvault_firewall_allowed_ips
keyvault_firewall_virtual_network_subnet_ids = var.keyvault_firewall_virtual_network_subnet_ids
}

# #keyvault (OpenAI Service Account details)
# kv_config = local.kv_config
# keyvault_resource_group_name = azurerm_resource_group.rg.name
# keyvault_firewall_default_action = var.keyvault_firewall_default_action
# keyvault_firewall_bypass = var.keyvault_firewall_bypass
# keyvault_firewall_allowed_ips = var.keyvault_firewall_allowed_ips
# keyvault_firewall_virtual_network_subnet_ids = var.keyvault_firewall_virtual_network_subnet_ids

# #Create OpenAI Service?
# create_openai_service = var.create_openai_service
Expand Down
8 changes: 3 additions & 5 deletions tests/auto_test1/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variable "vnet_address_space" {
}

variable "subnet_config" {
type = list(object({
type = object({
subnet_name = string
subnet_address_space = list(string)
service_endpoints = list(string)
Expand All @@ -41,9 +41,8 @@ variable "subnet_config" {
name = string
actions = list(string)
})))
}))
default = [
{
})
default = {
subnet_name = "app-cosmos-sub"
subnet_address_space = ["10.4.0.0/24"]
service_endpoints = ["Microsoft.AzureCosmosDB", "Microsoft.Web"]
Expand All @@ -58,7 +57,6 @@ variable "subnet_config" {
]
}
}
]
description = "A list of subnet configuration objects to create subnets in the virtual network."
}

Expand Down
16 changes: 11 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variable "vnet_address_space" {
}

variable "subnet_config" {
type = list(object({
type = object({
subnet_name = string
subnet_address_space = list(string)
service_endpoints = list(string)
Expand All @@ -44,8 +44,8 @@ variable "subnet_config" {
name = string
actions = list(string)
})))
}))
default = [
})
default =
{
subnet_name = "app-cosmos-sub"
subnet_address_space = ["10.4.0.0/24"]
Expand All @@ -61,11 +61,10 @@ variable "subnet_config" {
]
}
}
]
description = "A list of subnet configuration objects to create subnets in the virtual network."
}

### key vault ###
### 03 key vault ###
variable "kv_name" {
type = string
description = "Name of the Key Vault to create (solution secrets)."
Expand Down Expand Up @@ -102,6 +101,13 @@ variable "keyvault_firewall_virtual_network_subnet_ids" {
description = "value of key vault firewall allowed virtual network subnet ids."
}

### 04 OpenAI service ###
variable "account_name" {
type = string
default = "az-openai-account"
description = "The name of the OpenAI service."
}

# ####################################
# ### OpenAI service Module params ###
# ####################################
Expand Down

0 comments on commit 19a2a32

Please sign in to comment.