Skip to content

Commit 63c3ea4

Browse files
authored
Merge pull request #1 from streamdal/blinktag/ENG-1656_validjson
ENG-1656 - Fix valid_json module support
2 parents 45c14d7 + 8a16776 commit 63c3ea4

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

docs/resources/pipeline.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ Required:
8484

8585
At lease one of the following step type blocks is required:
8686

87-
- ``detective`` - (Block List, Max: 1) Detective Step (see [below for nested schema](#nestedblock--step--detective))
87+
- ``detective`` - (Block, Max: 1) Detective Step (see [below for nested schema](#nestedblock--step--detective))
8888
- ``dynamic`` - (Boolean) Should this step use the result from the previous step. This is valid **ONLY** for a transform step which immediately follows a detective step. Specifying `true` means
8989
any result from the detective step will be used as the path(s) for the transform step. (Default: `false`)
90-
- ``http_request`` - (Block List, Max: 1) HTTP Request Step (see [below for nested schema](#nestedblock--step--http_request))
90+
- ``http_request`` - (Block, Max: 1) HTTP Request Step (see [below for nested schema](#nestedblock--step--http_request))
9191

92-
- ``schema_validation`` - (Block List, Max: 1) Schema Validation Step (see [below for nested schema](#nestedblock--step--schema_validation))
93-
- ``transform`` - (Block List, Max: 1) Transform Step (see [below for nested schema](#nestedblock--step--transform))
92+
- ``schema_validation`` - (Block, Max: 1) Schema Validation Step (see [below for nested schema](#nestedblock--step--schema_validation))
93+
- ``transform`` - (Block, Max: 1) Transform Step (see [below for nested schema](#nestedblock--step--transform))
94+
- ``valid_json`` - (Block, Max 1) Determine if the payload is valid JSON. Does not need any configuration.
9495

9596
Optional parameters:
9697

examples/valid_json/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This example shows how to create a step which simply validates a JSON payload
2+
terraform {
3+
required_providers {
4+
streamdal = {
5+
version = "0.1.0"
6+
source = "streamdal.com/tf/streamdal"
7+
}
8+
}
9+
}
10+
11+
provider "streamdal" {
12+
token = "1234"
13+
address = "localhost:8082"
14+
connection_timeout = 10
15+
}
16+
17+
resource "streamdal_pipeline" "validate_my_json" {
18+
name = "Validate JSON Payload"
19+
step {
20+
name = "Validate JSON Step"
21+
dynamic = true
22+
valid_json {
23+
}
24+
}
25+
}

internal/provider/resource_pipeline.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,15 @@ func stepSchema() *schema.Resource {
283283
},
284284
},
285285
},
286-
//"valid_json": {
287-
// Description: "Valid JSON Step",
288-
// Type: schema.TypeList,
289-
// Optional: true,
290-
// MaxItems: 1,
291-
// Elem: &schema.Resource{},
292-
//},
286+
"valid_json": {
287+
Description: "Valid JSON Step",
288+
Type: schema.TypeList,
289+
Optional: true,
290+
MaxItems: 1,
291+
Elem: &schema.Resource{
292+
Schema: map[string]*schema.Schema{},
293+
},
294+
},
293295
"schema_validation": {
294296
Description: "Schema Validation Step",
295297
Type: schema.TypeList,

0 commit comments

Comments
 (0)