@@ -22,7 +22,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
22
22
name = "TestHttpMonitorResource - %s"
23
23
space_id = "testacc"
24
24
schedule = 5
25
- private_locations = [elasticstack_kibana_synthetics_private_location.test .label]
25
+ private_locations = [elasticstack_kibana_synthetics_private_location.%s .label]
26
26
enabled = true
27
27
tags = ["a", "b"]
28
28
alert = {
@@ -53,7 +53,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
53
53
name = "TestHttpMonitorResource Updated - %s"
54
54
space_id = "testacc"
55
55
schedule = 10
56
- private_locations = [elasticstack_kibana_synthetics_private_location.test .label]
56
+ private_locations = [elasticstack_kibana_synthetics_private_location.%s .label]
57
57
enabled = false
58
58
tags = ["c", "d", "e"]
59
59
alert = {
@@ -114,7 +114,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
114
114
name = "TestTcpMonitorResource - %s"
115
115
space_id = "default"
116
116
schedule = 5
117
- private_locations = [elasticstack_kibana_synthetics_private_location.test .label]
117
+ private_locations = [elasticstack_kibana_synthetics_private_location.%s .label]
118
118
enabled = true
119
119
tags = ["a", "b"]
120
120
alert = {
@@ -142,7 +142,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" {
142
142
name = "TestTcpMonitorResource Updated - %s"
143
143
space_id = "default"
144
144
schedule = 10
145
- private_locations = [elasticstack_kibana_synthetics_private_location.test .label]
145
+ private_locations = [elasticstack_kibana_synthetics_private_location.%s .label]
146
146
enabled = false
147
147
tags = ["c", "d", "e"]
148
148
alert = {
@@ -173,8 +173,8 @@ func TestSyntheticMonitorHTTPResource(t *testing.T) {
173
173
174
174
name := sdkacctest .RandStringFromCharSet (22 , sdkacctest .CharSetAlphaNum )
175
175
id := "http-monitor"
176
- httpMonitorId , config := testHttpMonitorConfig (id , httpMonitorConfig , name )
177
- _ , configUpdated := testHttpMonitorConfig (id , httpMonitorUpdated , name )
176
+ httpMonitorId , config := testMonitorConfig (id , httpMonitorConfig , name )
177
+ _ , configUpdated := testMonitorConfig (id , httpMonitorUpdated , name )
178
178
179
179
resource .Test (t , resource.TestCase {
180
180
PreCheck : func () { acctest .PreCheck (t ) },
@@ -270,8 +270,8 @@ func TestSyntheticMonitorTCPResource(t *testing.T) {
270
270
271
271
name := sdkacctest .RandStringFromCharSet (22 , sdkacctest .CharSetAlphaNum )
272
272
id := "tcp-monitor"
273
- tcpMonitorId , config := testHttpMonitorConfig (id , tcpMonitorConfig , name )
274
- _ , configUpdated := testHttpMonitorConfig (id , tcpMonitorUpdated , name )
273
+ tcpMonitorId , config := testMonitorConfig (id , tcpMonitorConfig , name )
274
+ _ , configUpdated := testMonitorConfig (id , tcpMonitorUpdated , name )
275
275
276
276
resource .Test (t , resource.TestCase {
277
277
PreCheck : func () { acctest .PreCheck (t ) },
@@ -354,9 +354,11 @@ func TestSyntheticMonitorTCPResource(t *testing.T) {
354
354
})
355
355
}
356
356
357
- func testHttpMonitorConfig (id , cfg , name string ) (string , string ) {
357
+ func testMonitorConfig (id , cfg , name string ) (string , string ) {
358
358
359
359
resourceId := "elasticstack_kibana_synthetics_monitor." + id
360
+ privateLocationId := "pl-" + id
361
+ agentPolicyId := "apl-" + id
360
362
361
363
provider := fmt .Sprintf (`
362
364
provider "elasticstack" {
@@ -365,7 +367,7 @@ provider "elasticstack" {
365
367
fleet{}
366
368
}
367
369
368
- resource "elasticstack_fleet_agent_policy" "test " {
370
+ resource "elasticstack_fleet_agent_policy" "%s " {
369
371
name = "TestMonitorResource Agent Policy - %s"
370
372
namespace = "testacc"
371
373
description = "TestMonitorResource Agent Policy"
@@ -374,14 +376,14 @@ resource "elasticstack_fleet_agent_policy" "test" {
374
376
skip_destroy = false
375
377
}
376
378
377
- resource "elasticstack_kibana_synthetics_private_location" "test " {
379
+ resource "elasticstack_kibana_synthetics_private_location" "%s " {
378
380
label = "TestMonitorResource-label-%s"
379
381
space_id = "testacc"
380
- agent_policy_id = elasticstack_fleet_agent_policy.test .policy_id
382
+ agent_policy_id = elasticstack_fleet_agent_policy.%s .policy_id
381
383
}
382
- ` , name , name )
384
+ ` , agentPolicyId , name , privateLocationId , name , agentPolicyId )
383
385
384
- config := fmt .Sprintf (cfg , id , name )
386
+ config := fmt .Sprintf (cfg , id , name , privateLocationId )
385
387
386
388
return resourceId , provider + config
387
389
}
0 commit comments