diff --git a/internal/services/bot/bot_service_azure_bot_resource_test.go b/internal/services/bot/bot_service_azure_bot_resource_test.go index 3a03ed63003b..29f0553b2ba5 100644 --- a/internal/services/bot/bot_service_azure_bot_resource_test.go +++ b/internal/services/bot/bot_service_azure_bot_resource_test.go @@ -183,13 +183,13 @@ resource "azurerm_application_insights_api_key" "test" { } resource "azurerm_bot_service_azure_bot" "test" { - name = "acctestdf%[1]d" - resource_group_name = azurerm_resource_group.test.name - location = "global" - microsoft_app_id = data.azurerm_client_config.current.client_id - sku = "F0" - local_authentication_enabled = false - + name = "acctestdf%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = "global" + microsoft_app_id = data.azurerm_client_config.current.client_id + sku = "F0" + local_authentication_enabled = false + icon_url = "https://registry.terraform.io/images/providers/azure.png" endpoint = "https://example.com" developer_app_insights_api_key = azurerm_application_insights_api_key.test.api_key developer_app_insights_application_id = azurerm_application_insights.test.app_id diff --git a/internal/services/bot/bot_service_resource_base.go b/internal/services/bot/bot_service_resource_base.go index b1bc2fdc890f..17b71bb744da 100644 --- a/internal/services/bot/bot_service_resource_base.go +++ b/internal/services/bot/bot_service_resource_base.go @@ -8,6 +8,7 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -135,6 +136,13 @@ func (br botBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[str Default: false, }, + "icon_url": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + ValidateFunc: validation.StringIsNotEmpty, + }, + "tags": tags.Schema(), } @@ -190,6 +198,7 @@ func (br botBaseResource) createFunc(resourceName, botKind string) sdk.ResourceF LuisAppIds: utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})), LuisKey: utils.String(metadata.ResourceData.Get("luis_key").(string)), IsStreamingSupported: utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)), + IconURL: utils.String(metadata.ResourceData.Get("icon_url").(string)), }, Tags: tags.Expand(metadata.ResourceData.Get("tags").(map[string]interface{})), } @@ -319,6 +328,8 @@ func (br botBaseResource) readFunc() sdk.ResourceFunc { streamingEndpointEnabled = *v } metadata.ResourceData.Set("streaming_endpoint_enabled", streamingEndpointEnabled) + + metadata.ResourceData.Set("icon_url", pointer.From(props.IconURL)) } return nil @@ -396,6 +407,10 @@ func (br botBaseResource) updateFunc() sdk.ResourceFunc { existing.Properties.IsStreamingSupported = utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)) } + if metadata.ResourceData.HasChange("icon_url") { + existing.Properties.IconURL = utils.String(metadata.ResourceData.Get("icon_url").(string)) + } + if _, err := client.Update(ctx, id.ResourceGroup, id.Name, existing); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } diff --git a/website/docs/r/bot_service_azure_bot.html.markdown b/website/docs/r/bot_service_azure_bot.html.markdown index a68870375dd1..9dec2b5c1251 100644 --- a/website/docs/r/bot_service_azure_bot.html.markdown +++ b/website/docs/r/bot_service_azure_bot.html.markdown @@ -74,6 +74,8 @@ The following arguments are supported: * `endpoint` - (Optional) The Azure Bot Service endpoint. +* `icon_url` - (Optional) The Icon Url of the Azure Bot Service. + * `microsoft_app_msi_id` - (Optional) The ID of the Microsoft App Managed Identity for this Azure Bot Service. Changing this forces a new resource to be created. * `microsoft_app_tenant_id` - (Optional) The Tenant ID of the Microsoft App for this Azure Bot Service. Changing this forces a new resource to be created.