@@ -270,3 +270,62 @@ func TestAccResourceKibanaConnectorIndex(t *testing.T) {
270
270
},
271
271
})
272
272
}
273
+
274
+ func TestAccResourceKibanaConnectorFromSDK (t * testing.T ) {
275
+ minSupportedVersion := version .Must (version .NewSemver ("7.14.0" ))
276
+
277
+ connectorName := sdkacctest .RandStringFromCharSet (22 , sdkacctest .CharSetAlphaNum )
278
+
279
+ create := func (name string ) string {
280
+ return fmt .Sprintf (`
281
+ provider "elasticstack" {
282
+ elasticsearch {}
283
+ kibana {}
284
+ }
285
+
286
+ resource "elasticstack_kibana_action_connector" "test" {
287
+ name = "%s"
288
+ config = jsonencode({
289
+ index = ".kibana"
290
+ refresh = true
291
+ })
292
+ connector_type_id = ".index"
293
+ }` ,
294
+ name )
295
+ }
296
+
297
+ resource .Test (t , resource.TestCase {
298
+ PreCheck : func () { acctest .PreCheck (t ) },
299
+ CheckDestroy : checkResourceKibanaConnectorDestroy ,
300
+ Steps : []resource.TestStep {
301
+ {
302
+ // Create the connector with the last provider version where the connector resource was built on the SDK
303
+ ExternalProviders : map [string ]resource.ExternalProvider {
304
+ "elasticstack" : {
305
+ Source : "elastic/elasticstack" ,
306
+ VersionConstraint : "0.11.17" ,
307
+ },
308
+ },
309
+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minSupportedVersion ),
310
+ Config : create (connectorName ),
311
+ Check : resource .ComposeTestCheckFunc (
312
+ testCommonAttributes (connectorName , ".index" ),
313
+
314
+ resource .TestMatchResourceAttr ("elasticstack_kibana_action_connector.test" , "config" , regexp .MustCompile (`\"index\":\"\.kibana\"` )),
315
+ resource .TestMatchResourceAttr ("elasticstack_kibana_action_connector.test" , "config" , regexp .MustCompile (`\"refresh\":true` )),
316
+ ),
317
+ },
318
+ {
319
+ ProtoV6ProviderFactories : acctest .Providers ,
320
+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minSupportedVersion ),
321
+ Config : create (connectorName ),
322
+ Check : resource .ComposeTestCheckFunc (
323
+ testCommonAttributes (connectorName , ".index" ),
324
+
325
+ resource .TestMatchResourceAttr ("elasticstack_kibana_action_connector.test" , "config" , regexp .MustCompile (`\"index\":\"\.kibana\"` )),
326
+ resource .TestMatchResourceAttr ("elasticstack_kibana_action_connector.test" , "config" , regexp .MustCompile (`\"refresh\":true` )),
327
+ ),
328
+ },
329
+ },
330
+ })
331
+ }
0 commit comments