Skip to content

Redevaerk/terraform-azurerm-bot-service

Repository files navigation

Terraform Azure Bot Service

Streamline the deployment of Azure Bot Services with our Terraform module. This all-inclusive solution not only creates your Azure Bot Service instances but also sets up the essential Azure AD application required for seamless authentication and secure interactions. Simplify your infrastructure provisioning while ensuring the proper integration of Azure Bot Services with Azure AD, enhancing the efficiency and security of your bot applications.

Usage

module "app" {
  source                     = "Redevaerk/bot-service/azurerm"
  version                    = "x.x.x"
  resource_group_name        = var.resource_group_name
  name                       = var.name
  endpoint                   = var.endpoint
  microsoft_app_id           = var.microsoft_app_id
  microsoft_app_type         = "SingleTenant"
  microsoft_app_tenant_id    = var.tenant_id
  tags = {
    environment = "test"
  }
}

Examples

  • Simple - This example will create simple Bot Service.
  • Single Tenant - This example will create single-tenant bot type and also creates the azure ad application.
  • Multi Tenant - This example will create multi-tenant bot type and also creates the azure ad application.
  • Channels - This example will create single-tenant bot type with several channels configured.
  • Private Endpoints - This example will create single-tenant bot type with private endpoints.

Requirements

Name Version
terraform >= 1.5.3
azuread ~>2.0
azurerm ~>3.75

Providers

Name Version
azuread ~>2.0
azurerm ~>3.75

Modules

Name Source Version
app Redevaerk/application/azuread 1.1.0
private_endpoint claranet/private-endpoint/azurerm 7.0.2

Resources

Name Type
azurerm_application_security_group.this resource
azurerm_bot_channel_directline.this resource
azurerm_bot_channel_web_chat.this resource
azurerm_bot_service_azure_bot.this resource
azurerm_private_endpoint_application_security_group_association.this resource
azuread_client_config.current data source

Inputs

Name Description Type Default Required
app_insights_application_id The resource ID of the Application Insights instance to associate with this Azure Bot Service. string null no
app_insights_key The Application Insights API Key to associate with this Azure Bot Service. string null no
attach_default_path_to_endpoint If true, the path /api/messages will be attached to the endpoint bool true no
create_app Create a new Microsoft Application for the Azure Bot Service. bool false no
create_bot Set it to false to not create bot bool true no
direct_line_sites A Direct Line site represents a client application that you want to connect to your bot.
list(object({
name = string
enabled = optional(bool)
user_upload_enabled = optional(bool)
endpoint_parameters_enabled = optional(bool)
storage_enabled = optional(bool)
v1_allowed = optional(bool)
v3_allowed = optional(bool)
enhanced_authentication_enabled = optional(bool)
trusted_origins = optional(list(string))
}))
[
{
"enabled": true,
"endpoint_parameters_enabled": false,
"enhanced_authentication_enabled": false,
"name": "default",
"storage_enabled": false,
"trusted_origins": [],
"user_upload_enabled": true,
"v1_allowed": true,
"v3_allowed": true
}
]
no
display_name The name that the Azure Bot Service will be displayed as. This defaults to the value set for name if not specified. string null no
endpoint The Azure Bot Service endpoint. string null no
icon_url The Icon Url of the Azure Bot Service. string null no
local_authentication_enabled Is local authentication enabled? Defaults to true. bool true no
location The supported Azure location where the Azure Bot Service should exist. Changing this forces a new resource to be created. string "global" no
luis_app_ids A list of LUIS App IDs to associate with this Azure Bot Service. list(string) [] no
luis_key The LUIS key to associate with this Azure Bot Service. string null no
microsoft_app_id The Microsoft Application ID for the Azure Bot Service. Changing this forces a new resource to be created. string null no
microsoft_app_tenant_id The Tenant ID of the Microsoft App for this Azure Bot Service. Changing this forces a new resource to be created. string null no
microsoft_app_type The Microsoft App Type for this Azure Bot Service. Possible values are MultiTenant, SingleTenant and UserAssignedMSI. Changing this forces a new resource to be created. string "SingleTenant" no
name The name which should be used for this Azure Bot Service. Changing this forces a new resource to be created. string n/a yes
private_endpoints Private Endpoints configuration to deploy
map(object({
vnet_id = string
subnet_id = string
subresource = optional(string, "Bot")
use_existing_private_dns_zone = optional(bool, false)
private_dns_zone_ids = optional(list(string), [])
ip_address = optional(string, null)
create_application_security_group = optional(bool, false)
}))
{} no
resource_group_name The name of the Resource Group where the Azure Bot Service should exist. Changing this forces a new resource to be created. string n/a yes
sku The SKU of the Azure Bot Service. Accepted values are F0 or S1. Changing this forces a new resource to be created. string "F0" no
streaming_endpoint_enabled Whether the Azure Bot Service Streaming Endpoint should be enabled. bool false no
tags A mapping of tags which should be assigned to this Azure Bot Service. map(string) {} no
web_chat_sites A Web Chat site represents a client application that you want to connect to your bot.
list(object({
name = string
user_upload_enabled = optional(bool)
endpoint_parameters_enabled = optional(bool)
storage_enabled = optional(bool)
}))
[
{
"endpoint_parameters_enabled": false,
"name": "default",
"storage_enabled": false,
"user_upload_enabled": true
}
]
no

Outputs

Name Description
direct_line_channel_id The Bot Direct Line Channel ID.
direct_line_sites The Direct Line Channel Sites.
microsoft_app_id The Microsoft Application ID for the Azure Bot Service.
microsoft_app_password The Microsoft Application Password.
microsoft_app_type The Microsoft App Type for this Azure Bot Service.
microsoft_tenant_id The Tenant ID of the Microsoft App for this Azure Bot Service.
private_endpoints Private Endpoints.
web_chat_channel_id The Web Chat Channel ID.

License

Apache 2 Licensed. See LICENSE for full details.