@@ -14,6 +14,7 @@ import (
1414 "github.com/aws/aws-sdk-go-v2/service/chatbot/types"
1515 sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
1616 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
17+ "github.com/hashicorp/terraform-plugin-testing/plancheck"
1718 "github.com/hashicorp/terraform-plugin-testing/terraform"
1819 "github.com/hashicorp/terraform-provider-aws/internal/acctest"
1920 "github.com/hashicorp/terraform-provider-aws/internal/conns"
@@ -46,6 +47,8 @@ func testAccSlackChannelConfiguration_basic(t *testing.T) {
4647
4748 var slackchannelconfiguration types.SlackChannelConfiguration
4849 rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
50+ rNameUpdated := rName + "-updated"
51+ resourceName := testResourceSlackChannelConfiguration
4952
5053 // The slack workspace must be created via the AWS Console. It cannot be created via APIs or Terraform.
5154 // 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) {
8184 ImportStateVerify : true ,
8285 ImportStateVerifyIdentifierAttribute : "chat_configuration_arn" ,
8386 },
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+ },
84105 },
85106 })
86107}
0 commit comments