Skip to content

Commit

Permalink
Merge pull request #23122 from neil-yechenwei/msteamschannel02
Browse files Browse the repository at this point in the history
`azurerm_bot_channel_ms_teams` - support for `deployment_environment`
  • Loading branch information
tombuildsstuff authored Sep 12, 2023
2 parents 7fc5d0e + e308530 commit 20fb3cb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
25 changes: 20 additions & 5 deletions internal/services/bot/bot_channel_ms_teams_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ func resourceBotChannelMsTeams() *pluginsdk.Resource {
ValidateFunc: validate.BotMSTeamsCallingWebHook(),
},

"deployment_environment": {
Type: pluginsdk.TypeString,
Optional: true,
Default: "CommercialDeployment",
ValidateFunc: validation.StringInSlice([]string{
"CommercialDeployment",
"GCCModerateDeployment",
}, false),
},

// TODO 4.0: change this from enable_* to *_enabled
"enable_calling": {
Type: pluginsdk.TypeBool,
Expand Down Expand Up @@ -95,8 +105,10 @@ func resourceBotChannelMsTeamsCreate(d *pluginsdk.ResourceData, meta interface{}
channel := botservice.BotChannel{
Properties: botservice.MsTeamsChannel{
Properties: &botservice.MsTeamsChannelProperties{
EnableCalling: utils.Bool(d.Get("enable_calling").(bool)),
IsEnabled: utils.Bool(true),
AcceptedTerms: utils.Bool(true),
DeploymentEnvironment: utils.String(d.Get("deployment_environment").(string)),
EnableCalling: utils.Bool(d.Get("enable_calling").(bool)),
IsEnabled: utils.Bool(true),
},
ChannelName: botservice.ChannelNameBasicChannelChannelNameMsTeamsChannel,
},
Expand Down Expand Up @@ -146,6 +158,7 @@ func resourceBotChannelMsTeamsRead(d *pluginsdk.ResourceData, meta interface{})
if channel, ok := props.AsMsTeamsChannel(); ok {
if channelProps := channel.Properties; channelProps != nil {
d.Set("calling_web_hook", channelProps.CallingWebhook)
d.Set("deployment_environment", channelProps.DeploymentEnvironment)
d.Set("enable_calling", channelProps.EnableCalling)
}
}
Expand All @@ -167,9 +180,11 @@ func resourceBotChannelMsTeamsUpdate(d *pluginsdk.ResourceData, meta interface{}
channel := botservice.BotChannel{
Properties: botservice.MsTeamsChannel{
Properties: &botservice.MsTeamsChannelProperties{
EnableCalling: utils.Bool(d.Get("enable_calling").(bool)),
CallingWebhook: utils.String(d.Get("calling_web_hook").(string)),
IsEnabled: utils.Bool(true),
AcceptedTerms: utils.Bool(true),
DeploymentEnvironment: utils.String(d.Get("deployment_environment").(string)),
EnableCalling: utils.Bool(d.Get("enable_calling").(bool)),
CallingWebhook: utils.String(d.Get("calling_web_hook").(string)),
IsEnabled: utils.Bool(true),
},
ChannelName: botservice.ChannelNameBasicChannelChannelNameMsTeamsChannel,
},
Expand Down
11 changes: 6 additions & 5 deletions internal/services/bot/bot_channel_ms_teams_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ func (BotChannelMsTeamsResource) basicUpdate(data acceptance.TestData) string {
%s
resource "azurerm_bot_channel_ms_teams" "test" {
bot_name = azurerm_bot_channels_registration.test.name
location = azurerm_bot_channels_registration.test.location
resource_group_name = azurerm_resource_group.test.name
calling_web_hook = "https://example.com/"
enable_calling = true
bot_name = azurerm_bot_channels_registration.test.name
location = azurerm_bot_channels_registration.test.location
resource_group_name = azurerm_resource_group.test.name
calling_web_hook = "https://example.com/"
enable_calling = true
deployment_environment = "CommercialDeployment"
}
`, BotChannelsRegistrationResource{}.basicConfig(data))
}
2 changes: 2 additions & 0 deletions website/docs/r/bot_channel_ms_teams.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ The following arguments are supported:

* `calling_web_hook` - (Optional) Specifies the webhook for Microsoft Teams channel calls.

* `deployment_environment` - (Optional) The deployment environment for Microsoft Teams channel calls. Possible values are `CommercialDeployment` and `GCCModerateDeployment`. Defaults to `CommercialDeployment`.

* `enable_calling` - (Optional) Specifies whether to enable Microsoft Teams channel calls. This defaults to `false`.

## Attributes Reference
Expand Down

0 comments on commit 20fb3cb

Please sign in to comment.