Skip to content

Commit 41351a6

Browse files
Brian Gustafsongreatestusername-splunk
Brian Gustafson
andauthored
Adds Custom Properties (splunk#33)
* adds .idea to gitignore * SYN-3197: Adds Custom Properties * Flattens custom properties for each check and returns * Adds build functions and fixes capitalization * adds to resources * fixes conflict * Adds validation for key and value in custom properties --------- Co-authored-by: greatestusername-splunk <[email protected]>
1 parent 0762dbf commit 41351a6

14 files changed

+324
-104
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@
3434
.terraform*
3535
terraform.tf*
3636
bin/*
37+
38+
# JetBrains (IntelliJ/GoLand)
39+
.idea

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
require (
66
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
77
github.com/splunk/syntheticsclient v1.0.3
8-
github.com/splunk/syntheticsclient/v2 v2.0.4
8+
github.com/splunk/syntheticsclient/v2 v2.0.5
99
)
1010

1111
require (

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
174174
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
175175
github.com/splunk/syntheticsclient v1.0.3 h1:I3PUgTnKZsCNGFH8OgBiQ+sZYYxOwcLmkbi3mp0Qq78=
176176
github.com/splunk/syntheticsclient v1.0.3/go.mod h1:riH4plM9ySr2lHnWi2E4cocaP9qqlRQHKX6nisiyq6E=
177-
github.com/splunk/syntheticsclient/v2 v2.0.4 h1:msnO8bksW/fwPlhsRfraKnjeLkpnlLXgWgxzrFWBYwE=
178-
github.com/splunk/syntheticsclient/v2 v2.0.4/go.mod h1:xP4ikfSyA0eVyI72sa11hi9yUDBaQhB5mtW6QSClaWw=
177+
github.com/splunk/syntheticsclient/v2 v2.0.5 h1:IWmXf1zqQMIrPNW/BYFe4geTvirXybWH7LXxkPBcZ8k=
178+
github.com/splunk/syntheticsclient/v2 v2.0.5/go.mod h1:xP4ikfSyA0eVyI72sa11hi9yUDBaQhB5mtW6QSClaWw=
179179
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
180180
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
181181
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=

synthetics/data_source_apicheck_v2.go

+17
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,23 @@ func dataSourceApiCheckV2() *schema.Resource {
253253
Type: schema.TypeString,
254254
Computed: true,
255255
},
256+
"custom_properties": {
257+
Type: schema.TypeSet,
258+
Computed: true,
259+
Optional: true,
260+
Elem: &schema.Resource{
261+
Schema: map[string]*schema.Schema{
262+
"key": {
263+
Type: schema.TypeString,
264+
Optional: true,
265+
},
266+
"value": {
267+
Type: schema.TypeString,
268+
Optional: true,
269+
},
270+
},
271+
},
272+
},
256273
},
257274
},
258275
},

synthetics/data_source_browsercheck_v2.go

+17
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,23 @@ func dataSourceBrowserCheckV2() *schema.Resource {
380380
},
381381
},
382382
},
383+
"custom_properties": {
384+
Type: schema.TypeSet,
385+
Computed: true,
386+
Optional: true,
387+
Elem: &schema.Resource{
388+
Schema: map[string]*schema.Schema{
389+
"key": {
390+
Type: schema.TypeString,
391+
Optional: true,
392+
},
393+
"value": {
394+
Type: schema.TypeString,
395+
Optional: true,
396+
},
397+
},
398+
},
399+
},
383400
},
384401
},
385402
},

synthetics/data_source_httpcheck_v2.go

+17
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,23 @@ func dataSourceHttpCheckV2() *schema.Resource {
158158
},
159159
},
160160
},
161+
"custom_properties": {
162+
Type: schema.TypeSet,
163+
Computed: true,
164+
Optional: true,
165+
Elem: &schema.Resource{
166+
Schema: map[string]*schema.Schema{
167+
"key": {
168+
Type: schema.TypeString,
169+
Optional: true,
170+
},
171+
"value": {
172+
Type: schema.TypeString,
173+
Optional: true,
174+
},
175+
},
176+
},
177+
},
161178
},
162179
},
163180
},

synthetics/data_source_portcheck_v2.go

+17
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ func dataSourcePortCheckV2() *schema.Resource {
8484
Type: schema.TypeInt,
8585
Computed: true,
8686
},
87+
"custom_properties": {
88+
Type: schema.TypeSet,
89+
Computed: true,
90+
Optional: true,
91+
Elem: &schema.Resource{
92+
Schema: map[string]*schema.Schema{
93+
"key": {
94+
Type: schema.TypeString,
95+
Optional: true,
96+
},
97+
"value": {
98+
Type: schema.TypeString,
99+
Optional: true,
100+
},
101+
},
102+
},
103+
},
87104
},
88105
},
89106
},

synthetics/resource_api_check_v2.go

+19
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,25 @@ func resourceApiCheckV2() *schema.Resource {
193193
Default: "round_robin",
194194
ValidateFunc: validation.StringMatch(regexp.MustCompile(`(^concurrent$|^round_robin$)`), "Setting must match concurrent or round_robin"),
195195
},
196+
"custom_properties": {
197+
Type: schema.TypeSet,
198+
Computed: true,
199+
Optional: true,
200+
Elem: &schema.Resource{
201+
Schema: map[string]*schema.Schema{
202+
"key": {
203+
Type: schema.TypeString,
204+
Optional: true,
205+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
206+
},
207+
"value": {
208+
Type: schema.TypeString,
209+
Optional: true,
210+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
211+
},
212+
},
213+
},
214+
},
196215
},
197216
},
198217
},

synthetics/resource_browser_check_v2.go

+21-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func resourceBrowserCheckV2() *schema.Resource {
9393
"collect_interactive_metrics": {
9494
Type: schema.TypeBool,
9595
Optional: true,
96-
Default: false,
96+
Default: false,
9797
},
9898
"authentication": {
9999
Type: schema.TypeSet,
@@ -242,7 +242,7 @@ func resourceBrowserCheckV2() *schema.Resource {
242242
"wait_for_nav": {
243243
Type: schema.TypeBool,
244244
Optional: true,
245-
Default: false,
245+
Default: false,
246246
},
247247
"options": {
248248
Type: schema.TypeSet,
@@ -262,6 +262,25 @@ func resourceBrowserCheckV2() *schema.Resource {
262262
},
263263
},
264264
},
265+
"custom_properties": {
266+
Type: schema.TypeSet,
267+
Computed: true,
268+
Optional: true,
269+
Elem: &schema.Resource{
270+
Schema: map[string]*schema.Schema{
271+
"key": {
272+
Type: schema.TypeString,
273+
Optional: true,
274+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
275+
},
276+
"value": {
277+
Type: schema.TypeString,
278+
Optional: true,
279+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
280+
},
281+
},
282+
},
283+
},
265284
},
266285
},
267286
},

synthetics/resource_http_check_v2.go

+19
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,25 @@ func resourceHttpCheckV2() *schema.Resource {
167167
},
168168
},
169169
},
170+
"custom_properties": {
171+
Type: schema.TypeSet,
172+
Computed: true,
173+
Optional: true,
174+
Elem: &schema.Resource{
175+
Schema: map[string]*schema.Schema{
176+
"key": {
177+
Type: schema.TypeString,
178+
Optional: true,
179+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
180+
},
181+
"value": {
182+
Type: schema.TypeString,
183+
Optional: true,
184+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
185+
},
186+
},
187+
},
188+
},
170189
},
171190
},
172191
},

synthetics/resource_port_check_v2.go

+19
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ func resourcePortCheckV2() *schema.Resource {
9999
Type: schema.TypeString,
100100
},
101101
},
102+
"custom_properties": {
103+
Type: schema.TypeSet,
104+
Computed: true,
105+
Optional: true,
106+
Elem: &schema.Resource{
107+
Schema: map[string]*schema.Schema{
108+
"key": {
109+
Type: schema.TypeString,
110+
Optional: true,
111+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
112+
},
113+
"value": {
114+
Type: schema.TypeString,
115+
Optional: true,
116+
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
117+
},
118+
},
119+
},
120+
},
102121
},
103122
},
104123
},

0 commit comments

Comments
 (0)