@@ -110,6 +110,77 @@ func TestAccKafkaCluster_basic(t *testing.T) {
110
110
})
111
111
}
112
112
113
+ func TestAccKafkaCluster_disappears (t * testing.T ) {
114
+ var cluster kafka.ClusterInfo
115
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
116
+ resourceName := "aws_msk_cluster.test"
117
+
118
+ resource .ParallelTest (t , resource.TestCase {
119
+ PreCheck : func () { acctest .PreCheck (t ); testAccPreCheck (t ) },
120
+ ErrorCheck : acctest .ErrorCheck (t , kafka .EndpointsID ),
121
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
122
+ CheckDestroy : testAccCheckClusterDestroy ,
123
+ Steps : []resource.TestStep {
124
+ {
125
+ Config : testAccClusterConfig_basic (rName ),
126
+ Check : resource .ComposeAggregateTestCheckFunc (
127
+ testAccCheckClusterExists (resourceName , & cluster ),
128
+ acctest .CheckResourceDisappears (acctest .Provider , tfkafka .ResourceCluster (), resourceName ),
129
+ ),
130
+ ExpectNonEmptyPlan : true ,
131
+ },
132
+ },
133
+ })
134
+ }
135
+
136
+ func TestAccKafkaCluster_tags (t * testing.T ) {
137
+ var cluster kafka.ClusterInfo
138
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
139
+ resourceName := "aws_msk_cluster.test"
140
+
141
+ resource .ParallelTest (t , resource.TestCase {
142
+ PreCheck : func () { acctest .PreCheck (t ); testAccPreCheck (t ) },
143
+ ErrorCheck : acctest .ErrorCheck (t , kafka .EndpointsID ),
144
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
145
+ CheckDestroy : testAccCheckClusterDestroy ,
146
+ Steps : []resource.TestStep {
147
+ {
148
+ Config : testAccClusterConfig_tags1 (rName , "key1" , "value1" ),
149
+ Check : resource .ComposeAggregateTestCheckFunc (
150
+ testAccCheckClusterExists (resourceName , & cluster ),
151
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "1" ),
152
+ resource .TestCheckResourceAttr (resourceName , "tags.key1" , "value1" ),
153
+ ),
154
+ },
155
+ {
156
+ ResourceName : resourceName ,
157
+ ImportState : true ,
158
+ ImportStateVerify : true ,
159
+ ImportStateVerifyIgnore : []string {
160
+ "current_version" ,
161
+ },
162
+ },
163
+ {
164
+ Config : testAccClusterConfig_tags2 (rName , "key1" , "value1updated" , "key2" , "value2" ),
165
+ Check : resource .ComposeAggregateTestCheckFunc (
166
+ testAccCheckClusterExists (resourceName , & cluster ),
167
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "2" ),
168
+ resource .TestCheckResourceAttr (resourceName , "tags.key1" , "value1updated" ),
169
+ resource .TestCheckResourceAttr (resourceName , "tags.key2" , "value2" ),
170
+ ),
171
+ },
172
+ {
173
+ Config : testAccClusterConfig_tags1 (rName , "key2" , "value2" ),
174
+ Check : resource .ComposeAggregateTestCheckFunc (
175
+ testAccCheckClusterExists (resourceName , & cluster ),
176
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "1" ),
177
+ resource .TestCheckResourceAttr (resourceName , "tags.key2" , "value2" ),
178
+ ),
179
+ },
180
+ },
181
+ })
182
+ }
183
+
113
184
func TestAccKafkaCluster_BrokerNodeGroupInfo_ebsVolumeSize (t * testing.T ) {
114
185
var cluster1 , cluster2 kafka.ClusterInfo
115
186
rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
@@ -1090,54 +1161,6 @@ func TestAccKafkaCluster_kafkaVersionUpgradeWithInfo(t *testing.T) {
1090
1161
})
1091
1162
}
1092
1163
1093
- func TestAccKafkaCluster_tags (t * testing.T ) {
1094
- var cluster kafka.ClusterInfo
1095
- rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
1096
- resourceName := "aws_msk_cluster.test"
1097
-
1098
- resource .ParallelTest (t , resource.TestCase {
1099
- PreCheck : func () { acctest .PreCheck (t ); testAccPreCheck (t ) },
1100
- ErrorCheck : acctest .ErrorCheck (t , kafka .EndpointsID ),
1101
- ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
1102
- CheckDestroy : testAccCheckClusterDestroy ,
1103
- Steps : []resource.TestStep {
1104
- {
1105
- Config : testAccClusterConfig_tags1 (rName , "key1" , "value1" ),
1106
- Check : resource .ComposeAggregateTestCheckFunc (
1107
- testAccCheckClusterExists (resourceName , & cluster ),
1108
- resource .TestCheckResourceAttr (resourceName , "tags.%" , "1" ),
1109
- resource .TestCheckResourceAttr (resourceName , "tags.key1" , "value1" ),
1110
- ),
1111
- },
1112
- {
1113
- ResourceName : resourceName ,
1114
- ImportState : true ,
1115
- ImportStateVerify : true ,
1116
- ImportStateVerifyIgnore : []string {
1117
- "current_version" ,
1118
- },
1119
- },
1120
- {
1121
- Config : testAccClusterConfig_tags2 (rName , "key1" , "value1updated" , "key2" , "value2" ),
1122
- Check : resource .ComposeAggregateTestCheckFunc (
1123
- testAccCheckClusterExists (resourceName , & cluster ),
1124
- resource .TestCheckResourceAttr (resourceName , "tags.%" , "2" ),
1125
- resource .TestCheckResourceAttr (resourceName , "tags.key1" , "value1updated" ),
1126
- resource .TestCheckResourceAttr (resourceName , "tags.key2" , "value2" ),
1127
- ),
1128
- },
1129
- {
1130
- Config : testAccClusterConfig_tags1 (rName , "key2" , "value2" ),
1131
- Check : resource .ComposeAggregateTestCheckFunc (
1132
- testAccCheckClusterExists (resourceName , & cluster ),
1133
- resource .TestCheckResourceAttr (resourceName , "tags.%" , "1" ),
1134
- resource .TestCheckResourceAttr (resourceName , "tags.key2" , "value2" ),
1135
- ),
1136
- },
1137
- },
1138
- })
1139
- }
1140
-
1141
1164
func testAccCheckResourceAttrIsSortedCSV (resourceName , attributeName string ) resource.TestCheckFunc {
1142
1165
return func (s * terraform.State ) error {
1143
1166
is , err := acctest .PrimaryInstanceState (s , resourceName )
0 commit comments