@@ -14,6 +14,7 @@ import (
14
14
"github.com/aws/aws-sdk-go-v2/service/chatbot/types"
15
15
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
16
16
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
17
+ "github.com/hashicorp/terraform-plugin-testing/plancheck"
17
18
"github.com/hashicorp/terraform-plugin-testing/terraform"
18
19
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
19
20
"github.com/hashicorp/terraform-provider-aws/internal/conns"
@@ -46,6 +47,8 @@ func testAccSlackChannelConfiguration_basic(t *testing.T) {
46
47
47
48
var slackchannelconfiguration types.SlackChannelConfiguration
48
49
rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
50
+ rNameUpdated := rName + "-updated"
51
+ resourceName := testResourceSlackChannelConfiguration
49
52
50
53
// The slack workspace must be created via the AWS Console. It cannot be created via APIs or Terraform.
51
54
// Once it is created, export the name of the workspace in the env variable for this test
@@ -81,6 +84,24 @@ func testAccSlackChannelConfiguration_basic(t *testing.T) {
81
84
ImportStateVerify : true ,
82
85
ImportStateVerifyIdentifierAttribute : "chat_configuration_arn" ,
83
86
},
87
+ {
88
+ Config : testAccSlackChannelConfigurationConfig_basic (rNameUpdated , channelID , teamID ),
89
+ ConfigPlanChecks : resource.ConfigPlanChecks {
90
+ PreApply : []plancheck.PlanCheck {
91
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionDestroyBeforeCreate ),
92
+ },
93
+ },
94
+ Check : resource .ComposeTestCheckFunc (
95
+ testAccCheckSlackChannelConfigurationExists (ctx , testResourceSlackChannelConfiguration , & slackchannelconfiguration ),
96
+ resource .TestCheckResourceAttr (testResourceSlackChannelConfiguration , "configuration_name" , rNameUpdated ),
97
+ acctest .MatchResourceAttrGlobalARN (ctx , testResourceSlackChannelConfiguration , "chat_configuration_arn" , "chatbot" , regexache .MustCompile (fmt .Sprintf (`chat-configuration/slack-channel/%s` , rName ))),
98
+ resource .TestCheckResourceAttrPair (testResourceSlackChannelConfiguration , names .AttrIAMRoleARN , "aws_iam_role.test" , names .AttrARN ),
99
+ resource .TestCheckResourceAttr (testResourceSlackChannelConfiguration , "slack_channel_id" , channelID ),
100
+ resource .TestCheckResourceAttrSet (testResourceSlackChannelConfiguration , "slack_channel_name" ),
101
+ resource .TestCheckResourceAttr (testResourceSlackChannelConfiguration , "slack_team_id" , teamID ),
102
+ resource .TestCheckResourceAttrSet (testResourceSlackChannelConfiguration , "slack_team_name" ),
103
+ ),
104
+ },
84
105
},
85
106
})
86
107
}
0 commit comments