Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Resource: azurerm_bot_channel_slack #4367

Merged
merged 4 commits into from Sep 19, 2019
Merged

New Resource: azurerm_bot_channel_slack #4367

merged 4 commits into from Sep 19, 2019

Conversation

mbfrahry
Copy link
Member

@mbfrahry mbfrahry commented Sep 18, 2019

        --- PASS: TestAccAzureRMBotChannelsRegistration/connection/basic (89.74s)
        --- PASS: TestAccAzureRMBotChannelsRegistration/connection/update (98.56s)

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @mbfrahry

Taking a look through this mostly LGTM - if we can fix up the comments this should otherwise be good to merge 👍

Thanks!

@@ -195,6 +195,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_batch_account": resourceArmBatchAccount(),
"azurerm_batch_application": resourceArmBatchApplication(),
"azurerm_batch_certificate": resourceArmBatchCertificate(),
"azurerm_bot_channel_slack": resourceArmBotChannelSlack(),
"azurerm_bot_channels_registration": resourceArmBotChannelsRegistration(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these both be channel_ or channels_?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. channels_registration houses every channel

},
ChannelName: botservice.ChannelNameSlackChannel1,
},
Location: utils.String(d.Get("location").(string)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to normalize this via:

Suggested change
Location: utils.String(d.Get("location").(string)),
Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))),

return fmt.Errorf("Error issuing create request for Bot Channel Slack (Resource Group %q / Bot %q): %+v", resourceGroup, botName, err)
}

resp, err := client.Get(ctx, resourceGroup, botName, string(botservice.ChannelNameSlackChannel))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to cast this to a string for the Create too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the SDK is weird in that create/update takes the ChannelName constant while the get/delete take strings instead. It's weird

azurerm/resource_arm_bot_channel_slack.go Outdated Show resolved Hide resolved
return nil
}

return fmt.Errorf("Error reading Bot Channel Slack (Resource Group %q / Bot %q): %+v", id.ResourceGroup, botName, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we match the ordering with other resources:

Suggested change
return fmt.Errorf("Error reading Bot Channel Slack (Resource Group %q / Bot %q): %+v", id.ResourceGroup, botName, err)
return fmt.Errorf("Error reading Channel Slack for Bot %q (Resource Group %q): %+v", botName, id.ResourceGroup, err)


if props := resp.Properties; props != nil {
if channel, ok := props.AsSlackChannel(); ok {
if channel != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this line, since otherwise ok would return false?

return fmt.Errorf("Error issuing create request for Bot Channel Slack (Resource Group %q / Bot %q): %+v", resourceGroup, botName, err)
}

resp, err := client.Get(ctx, resourceGroup, botName, string(botservice.ChannelNameSlackChannel))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same here) do we need to cast this to a string in all the calls? it's odd it's inconsistent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only because the SDK is inconsistent

page_title: "Azure Resource Manager: azurerm_bot_channel_slack"
sidebar_current: "docs-azurerm-resource-bot-channel-slack"
description: |-
Manages a Bot Channel for Slack.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this want to be:

Suggested change
Manages a Bot Channel for Slack.
Manages a Slack integration for a Bot Channel


# azurerm_bot_connection

Manages a Bot Channel for Slack.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same here)


## Import

Bot Channel can be imported using the `resource id`, e.g.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this want to be:

Suggested change
Bot Channel can be imported using the `resource id`, e.g.
The Slack Channel for a Bot can be imported using the `resource id`, e.g.

@tombuildsstuff tombuildsstuff added this to the v1.35.0 milestone Sep 19, 2019
@mbfrahry mbfrahry merged commit 979d49f into master Sep 19, 2019
@mbfrahry mbfrahry deleted the bot-channels branch September 19, 2019 19:54
@ghost
Copy link

ghost commented Oct 4, 2019

This has been released in version 1.35.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.35.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 29, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants