Skip to content

Commit

Permalink
Adds Custom Properties (#33)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
bgustafson and greatestusername-splunk authored Nov 15, 2023
1 parent 0762dbf commit 41351a6
Show file tree
Hide file tree
Showing 14 changed files with 324 additions and 104 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
.terraform*
terraform.tf*
bin/*

# JetBrains (IntelliJ/GoLand)
.idea
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
github.com/splunk/syntheticsclient v1.0.3
github.com/splunk/syntheticsclient/v2 v2.0.4
github.com/splunk/syntheticsclient/v2 v2.0.5
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/splunk/syntheticsclient v1.0.3 h1:I3PUgTnKZsCNGFH8OgBiQ+sZYYxOwcLmkbi3mp0Qq78=
github.com/splunk/syntheticsclient v1.0.3/go.mod h1:riH4plM9ySr2lHnWi2E4cocaP9qqlRQHKX6nisiyq6E=
github.com/splunk/syntheticsclient/v2 v2.0.4 h1:msnO8bksW/fwPlhsRfraKnjeLkpnlLXgWgxzrFWBYwE=
github.com/splunk/syntheticsclient/v2 v2.0.4/go.mod h1:xP4ikfSyA0eVyI72sa11hi9yUDBaQhB5mtW6QSClaWw=
github.com/splunk/syntheticsclient/v2 v2.0.5 h1:IWmXf1zqQMIrPNW/BYFe4geTvirXybWH7LXxkPBcZ8k=
github.com/splunk/syntheticsclient/v2 v2.0.5/go.mod h1:xP4ikfSyA0eVyI72sa11hi9yUDBaQhB5mtW6QSClaWw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand Down
17 changes: 17 additions & 0 deletions synthetics/data_source_apicheck_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ func dataSourceApiCheckV2() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
},
"value": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions synthetics/data_source_browsercheck_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,23 @@ func dataSourceBrowserCheckV2() *schema.Resource {
},
},
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
},
"value": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions synthetics/data_source_httpcheck_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ func dataSourceHttpCheckV2() *schema.Resource {
},
},
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
},
"value": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions synthetics/data_source_portcheck_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ func dataSourcePortCheckV2() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
},
"value": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
19 changes: 19 additions & 0 deletions synthetics/resource_api_check_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,25 @@ func resourceApiCheckV2() *schema.Resource {
Default: "round_robin",
ValidateFunc: validation.StringMatch(regexp.MustCompile(`(^concurrent$|^round_robin$)`), "Setting must match concurrent or round_robin"),
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
},
"value": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
},
},
},
},
},
},
},
Expand Down
23 changes: 21 additions & 2 deletions synthetics/resource_browser_check_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func resourceBrowserCheckV2() *schema.Resource {
"collect_interactive_metrics": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Default: false,
},
"authentication": {
Type: schema.TypeSet,
Expand Down Expand Up @@ -242,7 +242,7 @@ func resourceBrowserCheckV2() *schema.Resource {
"wait_for_nav": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Default: false,
},
"options": {
Type: schema.TypeSet,
Expand All @@ -262,6 +262,25 @@ func resourceBrowserCheckV2() *schema.Resource {
},
},
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
},
"value": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
},
},
},
},
},
},
},
Expand Down
19 changes: 19 additions & 0 deletions synthetics/resource_http_check_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,25 @@ func resourceHttpCheckV2() *schema.Resource {
},
},
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
},
"value": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
},
},
},
},
},
},
},
Expand Down
19 changes: 19 additions & 0 deletions synthetics/resource_port_check_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ func resourcePortCheckV2() *schema.Resource {
Type: schema.TypeString,
},
},
"custom_properties": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\S+\\w{1,128}\\S{1,}")),
},
"value": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile("^\\w{1,256}")),
},
},
},
},
},
},
},
Expand Down
Loading

0 comments on commit 41351a6

Please sign in to comment.