Git Product home page Git Product logo

terraform-azurerm-openai's Introduction

terraform-azurerm-openai

Azure OpenAI Terraform Module and Samples

Requirements

Name Version
terraform >= 1.3.0
azurerm ~> 3.0
modtm >= 0.1.8, < 1.0
random >= 3.0

Providers

Name Version
azurerm ~> 3.0
modtm >= 0.1.8, < 1.0
random >= 3.0

Modules

No modules.

Resources

Name Type
azurerm_cognitive_account.this resource
azurerm_cognitive_deployment.this resource
azurerm_monitor_diagnostic_setting.setting resource
azurerm_private_dns_zone.dns_zone resource
azurerm_private_dns_zone_virtual_network_link.dns_zone_link resource
azurerm_private_endpoint.this resource
modtm_telemetry.this resource
random_integer.this resource
azurerm_private_dns_zone.dns_zone data source
azurerm_resource_group.pe_vnet_rg data source
azurerm_resource_group.this data source
azurerm_subnet.pe_subnet data source
azurerm_virtual_network.vnet data source

Inputs

Name Description Type Default Required
account_name Specifies the name of the Cognitive Service Account. Changing this forces a new resource to be created. Leave this variable as default would use a default name with random suffix. string "" no
application_name Name of the application. A corresponding tag would be created on the created resources if var.default_tags_enabled is true. string "" no
custom_subdomain_name The subdomain name used for token-based authentication. Changing this forces a new resource to be created. Leave this variable as default would use a default name with random suffix. string "" no
customer_managed_key type = object({
key_vault_key_id = (Required) The ID of the Key Vault Key which should be used to Encrypt the data in this OpenAI Account.
identity_client_id = (Optional) The Client ID of the User Assigned Identity that has access to the key. This property only needs to be specified when there're multiple identities attached to the OpenAI Account.
})
object({
key_vault_key_id = string
identity_client_id = optional(string)
})
null no
default_tags_enabled Determines whether or not default tags are applied to resources. If set to true, tags will be applied. If set to false, tags will not be applied. bool false no
deployment type = map(object({
name = (Required) The name of the Cognitive Services Account Deployment. Changing this forces a new resource to be created.
cognitive_account_id = (Required) The ID of the Cognitive Services Account. Changing this forces a new resource to be created.
model = {
model_format = (Required) The format of the Cognitive Services Account Deployment model. Changing this forces a new resource to be created. Possible value is OpenAI.
model_name = (Required) The name of the Cognitive Services Account Deployment model. Changing this forces a new resource to be created.
model_version = (Required) The version of Cognitive Services Account Deployment model.
}
scale = {
scale_type = (Required) Deployment scale type. Possible value is Standard. Changing this forces a new resource to be created.
}
rai_policy_name = (Optional) The name of RAI policy. Changing this forces a new resource to be created.
capacity = (Optional) Tokens-per-Minute (TPM). The unit of measure for this field is in the thousands of Tokens-per-Minute. Defaults to 1 which means that the limitation is 1000 tokens per minute.
}))
map(object({
name = string
model_format = string
model_name = string
model_version = string
scale_type = string
rai_policy_name = optional(string)
capacity = optional(number)
}))
{} no
diagnostic_setting A map of objects that represent the configuration for a diagnostic setting."
type = map(object({
name = (Required) Specifies the name of the diagnostic setting. Changing this forces a new resource to be created.
log_analytics_workspace_id = (Optional) (Optional) Specifies the resource id of an Azure Log Analytics workspace where diagnostics data should be sent.
log_analytics_destination_type = (Optional) Possible values are AzureDiagnostics and Dedicated. When set to Dedicated, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
eventhub_name = (Optional) Specifies the name of the Event Hub where diagnostics data should be sent.
eventhub_authorization_rule_id = (Optional) Specifies the resource id of an Event Hub Namespace Authorization Rule used to send diagnostics data.
storage_account_id = (Optional) Specifies the resource id of an Azure storage account where diagnostics data should be sent.
partner_solution_id = (Optional) The resource id of the market partner solution where diagnostics data should be sent. For potential partner integrations, click to learn more about partner integration.
audit_log_retention_policy = (Optional) Specifies the retention policy for the audit log. This is a block with the following properties:
enabled = (Optional) Specifies whether the retention policy is enabled. If enabled, days must be a positive number.
days = (Optional) Specifies the number of days to retain trace logs. If enabled is set to true, this value must be set to a positive number.
request_response_log_retention_policy = (Optional) Specifies the retention policy for the request response log. This is a block with the following properties:
enabled = (Optional) Specifies whether the retention policy is enabled. If enabled, days must be a positive number.
days = (Optional) Specifies the number of days to retain trace logs. If enabled is set to true, this value must be set to a positive number.
trace_log_retention_policy = (Optional) Specifies the retention policy for the trace log. This is a block with the following properties:
enabled = (Optional) Specifies whether the retention policy is enabled. If enabled, days must be a positive number.
days = (Optional) Specifies the number of days to retain trace logs. If enabled is set to true, this value must be set to a positive number.
metric_retention_policy = (Optional) Specifies the retention policy for the metric. This is a block with the following properties:
enabled = (Optional) Specifies whether the retention policy is enabled. If enabled, days must be a positive number.
days = (Optional) Specifies the number of days to retain trace logs. If enabled is set to true, this value must be set to a positive number.
}))
map(object({
name = string
log_analytics_workspace_id = optional(string)
log_analytics_destination_type = optional(string)
eventhub_name = optional(string)
eventhub_authorization_rule_id = optional(string)
storage_account_id = optional(string)
partner_solution_id = optional(string)
audit_log_retention_policy = optional(object({
enabled = optional(bool, true)
days = optional(number, 7)
}))
request_response_log_retention_policy = optional(object({
enabled = optional(bool, true)
days = optional(number, 7)
}))
trace_log_retention_policy = optional(object({
enabled = optional(bool, true)
days = optional(number, 7)
}))
metric_retention_policy = optional(object({
enabled = optional(bool, true)
days = optional(number, 7)
}))
}))
{} no
dynamic_throttling_enabled Determines whether or not dynamic throttling is enabled. If set to true, dynamic throttling will be enabled. If set to false, dynamic throttling will not be enabled. bool null no
environment Environment of the application. A corresponding tag would be created on the created resources if var.default_tags_enabled is true. string "" no
fqdns List of FQDNs allowed for the Cognitive Account. list(string) null no
identity type = object({
type = (Required) The type of the Identity. Possible values are SystemAssigned, UserAssigned, SystemAssigned, UserAssigned.
identity_ids = (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this OpenAI Account.
})
object({
type = string
identity_ids = optional(list(string))
})
null no
local_auth_enabled Whether local authentication methods is enabled for the Cognitive Account. Defaults to true. bool true no
location Azure OpenAI deployment region. Set this variable to null would use resource group's location. string n/a yes
network_acls type = set(object({
default_action = (Required) The Default Action to use when no rules match from ip_rules / virtual_network_rules. Possible values are Allow and Deny.
ip_rules = (Optional) One or more IP Addresses, or CIDR Blocks which should be able to access the Cognitive Account.
virtual_network_rules = optional(set(object({
subnet_id = (Required) The ID of a Subnet which should be able to access the OpenAI Account.
ignore_missing_vnet_service_endpoint = (Optional) Whether ignore missing vnet service endpoint or not. Default to false.
})))
}))
set(object({
default_action = string
ip_rules = optional(set(string))
virtual_network_rules = optional(set(object({
subnet_id = string
ignore_missing_vnet_service_endpoint = optional(bool, false)
})))
}))
null no
outbound_network_access_restricted Whether outbound network access is restricted for the Cognitive Account. Defaults to false. bool false no
pe_subresource A list of subresource names which the Private Endpoint is able to connect to. subresource_names corresponds to group_id. Possible values are detailed in the product documentation in the Subresources column. Changing this forces a new resource to be created. list(string)
[
"account"
]
no
private_dns_zone A map of object that represents the existing Private DNS Zone you'd like to use. Leave this variable as default would create a new Private DNS Zone.
type = object({
name = "(Required) The name of the Private DNS Zone."
resource_group_name = "(Optional) The Name of the Resource Group where the Private DNS Zone exists. If the Name of the Resource Group is not provided, the first Private DNS Zone from the list of Private DNS Zones in your subscription that matches name will be returned."
}
object({
name = string
resource_group_name = optional(string)
})
null no
private_endpoint A map of objects that represent the configuration for a private endpoint."
type = map(object({
name = (Required) Specifies the Name of the Private Endpoint. Changing this forces a new resource to be created.
vnet_rg_name = (Required) Specifies the name of the Resource Group where the Private Endpoint's Virtual Network Subnet exists. Changing this forces a new resource to be created.
vnet_name = (Required) Specifies the name of the Virtual Network where the Private Endpoint's Subnet exists. Changing this forces a new resource to be created.
subnet_name = (Required) Specifies the name of the Subnet which Private IP Addresses will be allocated for this Private Endpoint. Changing this forces a new resource to be created.
dns_zone_virtual_network_link_name = (Optional) The name of the Private DNS Zone Virtual Network Link. Changing this forces a new resource to be created. Default to dns_zone_link.
private_dns_entry_enabled = (Optional) Whether or not to create a private_dns_zone_group block for the Private Endpoint. Default to false.
private_service_connection_name = (Optional) Specifies the Name of the Private Service Connection. Changing this forces a new resource to be created. Default to privateserviceconnection.
is_manual_connection = (Optional) Does the Private Endpoint require Manual Approval from the remote resource owner? Changing this forces a new resource to be created. Default to false.
}))
map(object({
name = string
vnet_rg_name = string
vnet_name = string
subnet_name = string
dns_zone_virtual_network_link_name = optional(string, "dns_zone_link")
private_dns_entry_enabled = optional(bool, false)
private_service_connection_name = optional(string, "privateserviceconnection")
is_manual_connection = optional(bool, false)
}))
{} no
public_network_access_enabled Whether public network access is allowed for the Cognitive Account. Defaults to false. bool false no
resource_group_name Name of the azure resource group to use. The resource group must exist. string n/a yes
sku_name Specifies the SKU Name for this Cognitive Service Account. Possible values are F0, F1, S0, S, S1, S2, S3, S4, S5, S6, P0, P1, P2, E0 and DC0. Default to S0. string "S0" no
tags (Optional) A mapping of tags to assign to the resource. map(string) {} no
tracing_tags_enabled Whether enable tracing tags that generated by BridgeCrew Yor. bool false no
tracing_tags_prefix Default prefix for generated tracing tags string "avm_" no

Outputs

Name Description
openai_endpoint The endpoint used to connect to the Cognitive Service Account.
openai_id The ID of the Cognitive Service Account.
openai_primary_key The primary access key for the Cognitive Service Account.
openai_secondary_key The secondary access key for the Cognitive Service Account.
openai_subdomain The subdomain used to connect to the Cognitive Service Account.
private_ip_addresses A map dictionary of the private IP addresses for each private endpoint.

Contributing

Before submitting a pull request, please make sure the following is done:

We provide a docker image to run the pre-commit checks and tests for you: mcr.microsoft.com/azterraform:latest

To run the pre-commit task, we can run the following command:

docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform:latest make pre-commit

On Windows Powershell:

docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest make pre-commit

In pre-commit task, we will:

  1. Run terraform fmt -recursive command for your Terraform code.
  2. Run terrafmt fmt -f command for markdown files and go code files to ensure that the Terraform code embedded in these files are well formatted.
  3. Run go mod tidy and go mod vendor for test folder to ensure that all the dependencies have been synced.
  4. Run gofmt for all go code files.
  5. Run gofumpt for all go code files.
  6. Run terraform-docs on README.md file, then run markdown-table-formatter to format markdown tables in README.md.

Then we can run the pr-check task to check whether our code meets our pipeline's requirement (We strongly recommend you run the following command before you commit):

docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform:latest make pr-check

On Windows Powershell:

docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest make pr-check

To run the e2e-test, we can run the following command:

docker run --rm -v $(pwd):/src -w /src -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_CLIENT_SECRET mcr.microsoft.com/azterraform:latest make e2e-test

On Windows Powershell:

docker run --rm -v ${pwd}:/src -w /src -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_CLIENT_SECRET mcr.microsoft.com/azterraform:latest make e2e-test

Enable or disable tracing tags

We're using BridgeCrew Yor and yorbox to help manage tags consistently across infrastructure as code (IaC) frameworks. In this module you might see tags like:

resource "azurerm_resource_group" "rg" {
  location = "eastus"
  name     = random_pet.name
  tags = merge(var.tags, (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
    avm_git_commit           = "3077cc6d0b70e29b6e106b3ab98cee6740c916f6"
    avm_git_file             = "main.tf"
    avm_git_last_modified_at = "2023-05-05 08:57:54"
    avm_git_org              = "lonegunmanb"
    avm_git_repo             = "terraform-yor-tag-test-module"
    avm_yor_trace            = "a0425718-c57d-401c-a7d5-f3d88b2551a4"
  } /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/))
}

To enable tracing tags, set the variable to true:

module "example" {
  source               = "{module_source}"
  ...
  tracing_tags_enabled = true
}

The tracing_tags_enabled is default to false.

To customize the prefix for your tracing tags, set the tracing_tags_prefix variable value in your Terraform configuration:

module "example" {
  source              = "{module_source}"
  ...
  tracing_tags_prefix = "custom_prefix_"
}

The actual applied tags would be:

{
  custom_prefix_git_commit           = "3077cc6d0b70e29b6e106b3ab98cee6740c916f6"
  custom_prefix_git_file             = "main.tf"
  custom_prefix_git_last_modified_at = "2023-05-05 08:57:54"
  custom_prefix_git_org              = "lonegunmanb"
  custom_prefix_git_repo             = "terraform-yor-tag-test-module"
  custom_prefix_yor_trace            = "a0425718-c57d-401c-a7d5-f3d88b2551a4"
}

Telemetry Collection

This module uses terraform-provider-modtm to collect telemetry data. This provider is designed to assist with tracking the usage of Terraform modules. It creates a custom modtm_telemetry resource that gathers and sends telemetry data to a specified endpoint. The aim is to provide visibility into the lifecycle of your Terraform modules - whether they are being created, updated, or deleted. This data can be invaluable in understanding the usage patterns of your modules, identifying popular modules, and recognizing those that are no longer in use.

The ModTM provider is designed with respect for data privacy and control. The only data collected and transmitted are the tags you define in module's modtm_telemetry resource, an uuid which represents a module instance's identifier, and the operation the module's caller is executing (Create/Update/Delete/Read). No other data from your Terraform modules or your environment is collected or transmitted.

One of the primary design principles of the ModTM provider is its non-blocking nature. The provider is designed to work in a way that any network disconnectedness or errors during the telemetry data sending process will not cause a Terraform error or interrupt your Terraform operations. This makes the ModTM provider safe to use even in network-restricted or air-gaped environments.

If the telemetry data cannot be sent due to network issues, the failure will be logged, but it will not affect the Terraform operation in progress(it might delay your operations for no more than 5 seconds). This ensures that your Terraform operations always run smoothly and without interruptions, regardless of the network conditions.

You can turn off the telemetry collection by declaring the following provider block in your root module:

provider "modtm" {
  enabled = false
}

terraform-azurerm-openai's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar joecks avatar lonegunmanb avatar microsoft-github-policy-service[bot] avatar paolosalvatori avatar soferreira avatar zioproto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

terraform-azurerm-openai's Issues

Model text-embedding-ada-002 deployment not working correctly

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.40

Module Version

N/A

AzureRM Provider Version

3.61

Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Terraform Configuration Files

resource "azurerm_resource_group" "rg" {
  location = "westeurope"
  name     = var.resource_group_name
}


resource "azurerm_cognitive_account" "openai" {
  kind                               = "OpenAI"
  location                           = azurerm_resource_group.rg.location
  name                               = var.openai_name
  resource_group_name                = azurerm_resource_group.rg.name
  sku_name                           = "S0"
  custom_subdomain_name              = var.openai_custom_subdomain_name
  dynamic_throttling_enabled         = null
  fqdns                              = null
  local_auth_enabled                 = false
  outbound_network_access_restricted = false
  public_network_access_enabled      = false


}

resource "azurerm_cognitive_deployment" "deployment" {
  cognitive_account_id = azurerm_cognitive_account.openai.id
  count                = length(var.openai_deployments)
  name                 = var.openai_deployments[count.index]

  model {
    format  = "OpenAI"
    name    = var.openai_deployments[count.index]
    version = "1"
  }
  scale {
    # type = "Standard"
    type = "Standard"
  }
}

tfvars variables values

# Openai
openai_name                  = "openaiXXXX"
openai_custom_subdomain_name = "azure-openai-XXX"
openai_deployments           = ["text-ada-001", "text-embedding-ada-002"]

## Resource group
resouresource_group_name = "XXXX-test-rg"

Debug Output/Panic Output

Error: creating Deployment (Subscription: "XXXX"
│ Resource Group Name: "XXXX-test-rg"
│ Account Name: "openaiXXX"
│ Deployment Name: "text-embedding-ada-002"): performing CreateOrUpdate: unexpected status 400 with error: InvalidResourceProperties: The specified scale type 'Standard' of account deployment is not supported by the model 'text-embedding-ada-002'.
│
│   with azurerm_cognitive_deployment.deployment[1],
│   on openai2.tf line 18, in resource "azurerm_cognitive_deployment" "deployment":
│   18: resource "azurerm_cognitive_deployment" "deployment" {
│
│ creating Deployment (Subscription: "XXXX"
│ Resource Group Name: "XXX-test-rg"
│ Account Name: "openaiXXX"
│ Deployment Name: "text-embedding-ada-002"): performing CreateOrUpdate: unexpected status 400 with error: InvalidResourceProperties: The specified scale type'Standard' of account deployment is not supported by the model 'text-embedding-ada-002'.

Expected Behaviour

It should deploy because the only option for scale type is Standard

Actual Behaviour

it throws an error

Steps to Reproduce

init
apply

Important Factoids

No response

References

No response

Support for deployment.scale.capacity

Is there an existing issue for this?

  • I have searched the existing issues

Description

The capacity value is required to define the tokens per minute value.

It would be amazing if we could adjust that value.

New or Affected Resource(s)/Data Source(s)

terraform-azurerm-openai

Potential Terraform Configuration

module "openai" {
  source                        = "../.."
  resource_group_name           = azurerm_resource_group.this.name
  location                      = azurerm_resource_group.this.location
  public_network_access_enabled = true
  deployment = {
    "text-davinci-003" = {
      name          = "text-davinci-003"
      model_format  = "OpenAI"
      model_name    = "text-davinci-003"
      model_version = "1"
      scale_type    = "Standard"
      # 10 = 10k token per minute
      capacity      = 10
    },
  }
  depends_on = [
    azurerm_resource_group.this
  ]
}

References

No response

Network ACL's is not working

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.4.0

Module Version

0.1.1

AzureRM Provider Version

v3.83.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_account

Terraform Configuration Files

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

tfvars variables values

variable "network_acls" {
  
  default = [
  {
    default_action = "Allow"
  },
  ]
}

Debug Output/Panic Output

│ Error: Unsupported attribute
│ 
│   on .terraform/modules/openai/main.tf line 55, in resource "azurerm_cognitive_account" "this":
│   55:       default_action = network_acls.value.default_action
│     ├────────────────
│     │ network_acls.value is list of object with 1 element
│ 
│ Can't access attributes on a list of objects. Did you mean to access attribute "default_action" for a specific element of the list, or across all elements of the list?

Expected Behaviour

it should accept the set of object.

Actual Behaviour

Throw an error

Steps to Reproduce

terraform plan with network_acl variable defined.

Important Factoids

No response

References

No response

Support for content filters

Is there an existing issue for this?

  • I have searched the existing issues

Description

Azure OpenAI has introduced the ability to configure content filters (How to configure content filters with Azure OpenAI Service).

Terraform already supports specifying a custom policy name via rai_policy_name. However, it does not appear that Terraform currently supports creating custom policies.

The underlying REST call made to create a new content filter is looks like below.

PUT https://management.azure.com/subscriptions/5001b330-4456-4782-8a95-5be13fe6f00a/resourceGroups/my-resource-group/providers/Microsoft.CognitiveServices/accounts/my-openai-account/raiPolicies/MyCustomRaiPolicy?api-version=2023-06-01-preview

with a body like

{
  "name": "Test",
  "displayName": "",
  "properties": {
    "basePolicyName": "Microsoft.Default",
    "type": "UserManaged",
    "contentFilters": [
      {
        "name": "hate",
        "blocking": false,
        "enabled": true,
        "allowedContentLevel": "medium",
        "source": "prompt"
      },
      {
        "name": "sexual",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "high",
        "source": "prompt"
      },
      {
        "name": "selfharm",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "low",
        "source": "prompt"
      },
      {
        "name": "violence",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "medium",
        "source": "prompt"
      },
      {
        "name": "hate",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "low",
        "source": "completion"
      },
      {
        "name": "sexual",
        "blocking": false,
        "enabled": true,
        "allowedContentLevel": "medium",
        "source": "completion"
      },
      {
        "name": "selfharm",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "medium",
        "source": "completion"
      },
      {
        "name": "violence",
        "blocking": true,
        "enabled": true,
        "allowedContentLevel": "high",
        "source": "completion"
      }
    ]
  }
}

New or Affected Resource(s)/Data Source(s)

azurerm_cognitive_rai_policy

Potential Terraform Configuration

resource "azurerm_cognitive_rai_policy" "my_policy" {
  name                 = "MyCustomRaiPolicy"
  display_name         = "My custom RAI policy"
  cognitive_account_id = "/subscriptions/5001b330-4456-4782-8a95-5be13fe6f00a/resourceGroups/my-resource-group/providers/Microsoft.CognitiveServices/accounts/my-openai-account"
  content_filters = [
    {
      name = "hate"
      blocking = false
      enabled = true // This is the default.
      allowed_content_level = "high"
      source = "prompt"
    },
    {
      name = "sexual"
      blocking = true // This is the default.
      // Omit default value for `enabled`.
      allowed_content_level = "high"
      source = "completion"
    }
  ]
}

References

RBAC docs for Microsoft.CognitiveServices/accounts/raiPolicies/*: https://learn.microsoft.com/en-us/azure/role-based-access-control/resource-provider-operations

Support for Additional Tags

Is there an existing issue for this?

  • I have searched the existing issues

Description

Currently it appears that the tags are limited to application_name and environment.
https://github.com/Azure/terraform-azurerm-openai/blob/main/main.tf#L9

While looking to standardize tagging strategy based on customer's requirements, flexibility in the ability to provide custom tags would be essential.

New or Affected Resource(s)/Data Source(s)

all tagged resources

Potential Terraform Configuration

perhaps adding a new variable "additional_tags":

variable "additional_tags" {
  default = {}
}

and on https://github.com/Azure/terraform-azurerm-openai/blob/main/main.tf#L9

  tags = merge(var.additional_tags, (var.default_tags_enabled ? {
    Application_Name = var.application_name
    Environment      = var.environment
  } : {})

(FYI haven't tested the function above works)

References

No response

Error when trying to create an Azure OpenAI resource using this module

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.5.0

Module Version

0.1.1

AzureRM Provider Version

3.60.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_deployment

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~>3.60.0"
    }
  }
  required_version = ">=1.4.0"
}

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "resource_group" {
  name     = var.resource_group_name
  location = var.location
}

module "openai" {
  source                        = "Azure/openai/azurerm"
  version                       = "0.1.1"
  resource_group_name           = azurerm_resource_group.resource_group.name
  location                      = azurerm_resource_group.resource_group.location
  account_name                  = var.cognitive_service_account_name
  application_name              = var.openai_application_name
  public_network_access_enabled = true
  depends_on                    = [azurerm_resource_group.resource_group]
  deployment = {
    "gpt-35-turbo" = {
      name          = "gpt-35-turbo"
      model_format  = "OpenAI"
      model_name    = "gpt-35-turbo"
      model_version = "1"
      scale_type    = "Standard"
    }
  }
}

tfvars variables values

resource_group_name = "azure_openai_rg"
location = "East US"
cognitive_service_account_name = "terraform-azure-openai-testing"
openai_application_name = "terraform-azure-openai-testing"

Debug Output/Panic Output

Deployment Name: "gpt-35-turbo"): performing CreateOrUpdate: unexpected status 400 with error: DeploymentModelNotSupported: The model 'Format: OpenAI, Name: gpt-35-turbo, Version: 1, Source: ' of account deployment is not supported.
│ 
│   with module.openai.azurerm_cognitive_deployment.this["gpt-35-turbo"],
│   on .terraform/modules/openai/main.tf line 74, in resource "azurerm_cognitive_deployment" "this":
│   74: resource "azurerm_cognitive_deployment" "this" {

│ Deployment Name: "gpt-35-turbo"): performing CreateOrUpdate: unexpected status 400 with error:
│ DeploymentModelNotSupported: The model 'Format: OpenAI, Name: gpt-35-turbo, Version: 1, Source: ' of account
│ deployment is not supported.

Expected Behaviour

Deployment is supported and I am able to deploy a GPT 3.5 Turbo model using Terraform.

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.