hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.63k forks source link

Missing keys in azurerm_bot_channel_directline: extensionKey1, extensionKey2 #8248

Closed ikru closed 3 years ago

ikru commented 4 years ago

Community Note

Description

Hi,

I am using azurerm_bot_channel_directline on ASE and there are two relatively new keys, that are not exposed in the azurerm_bot_channel_directline: extensionKey1, extensionKey2. It would be nice if they were implemented as output, so we could use them as azurerm_bot_channel_directline.mydl.extensionKey1 / azurerm_bot_channel_directline.mydl.extensionKey2 in other resources.

In Azure they are available in direct line settings:

image

Also it can be retrieved with az cli:

az bot directline show --resource-group MY_RESOURCE_GROUP --name MY-BOT-WEB-APP --with-secrets

{
  "changedTime": "0001-01-01T00:00:00Z",
  "entityTag": "W/\"qwerty/25/2020 2:46:52 PM\"",
  "etag": null,
  "id": "/subscriptions/<subscriptionid>/resourceGroups/RG/providers/Microsoft.BotService/botServices/MY_BOT_NAME/channels/DirectLineChannel",
  "kind": null,
  "location": "global",
  "name": null,
  "properties": {
    "channelName": "DirectLineChannel",
    "etag": "W/\"qwerty/25/2020 2:46:52 PM\"",
    "location": "global",
    "properties": {
      "DirectLineEmbedCode": null,
      "sites": [
        {
          "isBlockUserUploadEnabled": false,
          "isEnabled": true,
          "isSecureSiteEnabled": false,
          "isV1Enabled": true,
          "isV3Enabled": true,
          "key": "qwerty.TCfg4MEPahPdeMxdeRmfhDgqeGRkbRlFJ4x69NXTtbA",
          "key2": "qwerty.Oz3QZQFU5E8Bu4E96qjVQSJBmRdENPd09IjEUncuDV0",
          "siteId": "qwerty",
          "siteName": "Default Site",
          "trustedOrigins": null
        }
      ]
    }
  },
  "provisioningState": "Accepted",
  "resource": {
    "channelName": "DirectLineChannel",
    "etag": "W/\"qwerty/25/2020 2:46:52 PM\"",
    "location": "global",
    "properties": {
      "sites": [
        {
          "isBlockUserUploadEnabled": false,
          "isEnabled": true,
          "isSecureSiteEnabled": false,
          "isV1Enabled": true,
          "isV3Enabled": true,
          "key": "qwerty.TCfg4MEPahPdeMxdeRmfhDgqeGRkbRlFJ4x69NXTtbA",
          "key2": "qwerty.Oz3QZQFU5E8Bu4E96qjVQSJBmRdENPd09IjEUncuDV0",
          "siteId": "qwerty",
          "siteName": "Default Site"
        }
      ]
    }
  },
  "resourceGroup": "RESOURCE_GROUP_NAME",
  "setting": {
    "botIconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
    "botId": "MY_BOT_NAME",
    "channelDisplayName": "Direct Line",
    "channelId": "directline",
    "extensionKey1": "qwerty.GNeFkWm8RE626WtgQQdrcMjpV5FQHBheY3RvZqNfqkY",
    "extensionKey2": "qwerty.USs7930NV1JTnw2tk_ai9FVCYfaaJ46OMn5c2kIY_5Q",
    "isEnabled": true,
    "sites": [
      {
        "eTag": "\"qwerty\"",
        "isBlockUserUploadEnabled": false,
        "isEnabled": true,
        "isSecureSiteEnabled": false,
        "isV1Enabled": true,
        "isV3Enabled": true,
        "isWebchatPreviewEnabled": false,
        "key": "qwerty.TCfg4MEPahPdeMxdeRmfhDgqeGRkbRlFJ4x69NXTtbA",
        "key2": "qwerty.Oz3QZQFU5E8Bu4E96qjVQSJBmRdENPd09IjEUncuDV0",
        "siteId": "qwerty",
        "siteName": "Default Site"
      }
    ]
  },
  "sku": null,
  "tags": null,
  "type": null
}
(IDs are fake)

Wanted to note, that these are different keys from those available under direct line sites as key1, key2.

Community Note

Description

New or Affected Resource(s)

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

tombuildsstuff commented 3 years ago

Closing since this is now available within the site block: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/bot_channel_directline#key

ikru commented 3 years ago

Hi @tombuildsstuff,

There are two set of keys in direct line channel:

  1. Under site key1, key2 - these were always available
  2. Under settings extensionKey1, extensionKey2 - these are still missing. Please look at the picture and json in the description.

Thanks

ikru commented 3 years ago

Please reopen?

ikru commented 3 years ago

Hey @tombuildsstuff, @mybayern1974,

Please reopen: There are two set of keys in direct line channel:

Under site key1, key2 - these were always available Under settings extensionKey1, extensionKey2 - these are still missing!!! Please look at the picture and json in the description. Thanks

neil-yechenwei commented 3 years ago

Thanks @ikru for raising this issue. Seems it's by design. TF would ignore the default site. I assume you have to create bot directline channel with custom site name. Below is a sample.

resource "azurerm_bot_channel_directline" "test" {
  bot_name            = azurerm_bot_channels_registration.test.name
  location            = azurerm_bot_channels_registration.test.location
  resource_group_name = azurerm_resource_group.test.name

  site {
    name    = "UserCustomTestSite"
    enabled = true
  }
}
ikru commented 3 years ago

Hi @neil-yechenwei,

Not really it's a separate set if keys for completely different purpose. These keys are there to configure bot for direct line extension. They just need to be added as properties for directline channel.

Please Look at json in my original message: extensionKey1 extensionKey2

They aren't under sites and they have nothing to do with sites.

neil-yechenwei commented 3 years ago

@ikru , thanks for your clarification. After investigated, I found seems extensionKey1 and extensionKey2 aren't in the properties section of API response. So GO sdk client doesn't handle them. Hence I assume it's Service API problem not TF problem. I raised an issue on azure-rest-api-spec for tracking this question.

ikru commented 3 years ago

Ok, thank you! Can you reopen this one as well to address these keys after api is updated?

github-actions[bot] commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.