Skip to content

Commit 9d542e6

Browse files
azurerm_bot_service_azure_bot - fix acctest, make microsoft_app_type required for 5.0 (#30460)
Co-authored-by: sreallymatt <106555974+sreallymatt@users.noreply.github.com>
1 parent 54102ed commit 9d542e6

4 files changed

Lines changed: 36 additions & 12 deletions

File tree

internal/services/bot/bot_service_azure_bot_resource.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (r AzureBotServiceResource) Arguments() map[string]*pluginsdk.Schema {
152152

153153
"microsoft_app_type": {
154154
Type: pluginsdk.TypeString,
155-
Optional: true,
155+
Required: true,
156156
ForceNew: true,
157157
ValidateFunc: validation.StringInSlice([]string{
158158
string(botservice.MsaAppTypeMultiTenant),
@@ -207,6 +207,19 @@ func (r AzureBotServiceResource) Arguments() map[string]*pluginsdk.Schema {
207207

208208
if !features.FivePointOh() {
209209
output["cmk_key_vault_key_url"].ValidateFunc = keyvault.ValidateNestedItemID(keyvault.VersionTypeAny, keyvault.NestedItemTypeAny)
210+
211+
output["microsoft_app_type"] = &pluginsdk.Schema{
212+
Type: pluginsdk.TypeString,
213+
Optional: true,
214+
// Note: O+C because Azure sets a value for this if omitted
215+
Computed: true,
216+
ForceNew: true,
217+
ValidateFunc: validation.StringInSlice([]string{
218+
string(botservice.MsaAppTypeMultiTenant),
219+
string(botservice.MsaAppTypeSingleTenant),
220+
string(botservice.MsaAppTypeUserAssignedMSI),
221+
}, false),
222+
}
210223
}
211224

212225
return output

internal/services/bot/bot_service_azure_bot_resource_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,13 @@ func (BotServiceAzureBotResource) requiresImport(data acceptance.TestData) strin
244244
%s
245245
246246
resource "azurerm_bot_service_azure_bot" "import" {
247-
name = azurerm_bot_service_azure_bot.test.name
248-
resource_group_name = azurerm_bot_service_azure_bot.test.resource_group_name
249-
location = azurerm_bot_service_azure_bot.test.location
250-
sku = azurerm_bot_service_azure_bot.test.sku
251-
microsoft_app_id = azurerm_bot_service_azure_bot.test.microsoft_app_id
252-
microsoft_app_type = azurerm_bot_service_azure_bot.test.microsoft_app_type
247+
name = azurerm_bot_service_azure_bot.test.name
248+
resource_group_name = azurerm_bot_service_azure_bot.test.resource_group_name
249+
location = azurerm_bot_service_azure_bot.test.location
250+
sku = azurerm_bot_service_azure_bot.test.sku
251+
microsoft_app_id = azurerm_bot_service_azure_bot.test.microsoft_app_id
252+
microsoft_app_type = azurerm_bot_service_azure_bot.test.microsoft_app_type
253+
microsoft_app_tenant_id = azurerm_bot_service_azure_bot.test.microsoft_app_tenant_id
253254
}
254255
`, template)
255256
}

website/docs/5.0-upgrade-guide.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ Please follow the format in the example below for listing breaking changes in re
300300

301301
* The deprecated `certificate` property has been removed.
302302

303+
### `azurem_bot_service_azure_bot`
304+
305+
* The `microsoft_app_type` property is now required.
306+
303307
### `azurerm_bot_channel_ms_teams`
304308

305309
* The deprecated `enable_calling` property has been removed in favour of the `calling_enabled` property.

website/docs/r/bot_service_azure_bot.html.markdown

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Manages an Azure Bot Service.
1313
## Example Usage
1414

1515
```hcl
16+
data "azurerm_client_config" "current" {}
17+
1618
resource "azurerm_resource_group" "example" {
1719
name = "example-resources"
1820
location = "West Europe"
@@ -34,11 +36,13 @@ resource "azurerm_application_insights_api_key" "example" {
3436
data "azurerm_client_config" "current" {}
3537
3638
resource "azurerm_bot_service_azure_bot" "example" {
37-
name = "exampleazurebot"
38-
resource_group_name = azurerm_resource_group.example.name
39-
location = "global"
40-
microsoft_app_id = data.azurerm_client_config.current.client_id
41-
sku = "F0"
39+
name = "exampleazurebot"
40+
resource_group_name = azurerm_resource_group.example.name
41+
location = "global"
42+
microsoft_app_id = data.azurerm_client_config.current.client_id
43+
microsoft_app_type = "SingleTenant"
44+
microsoft_app_tenant_id = data.azurerm_client_config.current.tenant_id
45+
sku = "F0"
4246
4347
endpoint = "https://example.com"
4448
developer_app_insights_api_key = azurerm_application_insights_api_key.example.api_key
@@ -86,6 +90,8 @@ The following arguments are supported:
8690

8791
* `microsoft_app_type` - (Optional) 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.
8892

93+
~> **Note:** Creation of `azurerm_bot_service_azure_bot` resources using the `MultiTenant` type is no longer supported by Azure, existing resources can continue using this type.
94+
8995
* `local_authentication_enabled` - (Optional) Is local authentication enabled? Defaults to `true`.
9096

9197
* `luis_app_ids` - (Optional) A list of LUIS App IDs to associate with this Azure Bot Service.

0 commit comments

Comments
 (0)