Skip to content

Commit c23195d

Browse files
committed
fix(docs): include code examples
Includes code examples for new resources in the provider documentation, which is a step I missed when publishing the previous release.
1 parent 8813888 commit c23195d

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

docs/data-sources/errors.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,36 @@ description: |-
1010

1111
Causes an error to be thrown if the condition is true.
1212

13+
## Example Usage
1314

15+
```terraform
16+
variable "one" {}
17+
variable "two" {}
18+
19+
data "validation_errors" "errs" {
20+
21+
error {
22+
condition = var.one == var.two
23+
summary = "var.one and var.two must never be equal"
24+
details = <<EOF
25+
When var.one and var.two are equal, bad things can happen.
26+
Please use differing values for these inputs.
27+
var.one: ${var.one}
28+
var.two: ${var.two}
29+
EOF
30+
}
31+
32+
error {
33+
condition = var.one % 2 == 0
34+
summary = "var.one cannot be even"
35+
}
36+
37+
error {
38+
condition = var.two % 2 != 0
39+
summary = "var.two cannot be odd"
40+
}
41+
}
42+
```
1443

1544
<!-- schema generated by tfplugindocs -->
1645
## Schema

docs/data-sources/warnings.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,36 @@ description: |-
1010

1111
Causes one or more warnings to be shown if the condition is true.
1212

13+
## Example Usage
1314

15+
```terraform
16+
variable "one" {}
17+
variable "two" {}
18+
19+
data "validation_warnings" "warns" {
20+
21+
warning {
22+
condition = var.one == var.two
23+
summary = "var.one and var.two are equal. This will cause an error in future versions"
24+
details = <<EOF
25+
In a future release of this code, var.one and var.two may no longer be equal.
26+
Please consider modifying the values to avoid execution failures.
27+
var.one: ${var.one}
28+
var.two: ${var.two}
29+
EOF
30+
}
31+
32+
warning {
33+
condition = var.one % 2 == 0
34+
summary = "var.one should not be even"
35+
}
36+
37+
warning {
38+
condition = var.two % 2 != 0
39+
summary = "var.two should not be odd"
40+
}
41+
}
42+
```
1443

1544
<!-- schema generated by tfplugindocs -->
1645
## Schema

docs/resources/errors.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,36 @@ description: |-
1010

1111
Causes one or more errors to be thrown during execution if the condition is true
1212

13+
## Example Usage
1314

15+
```terraform
16+
variable "one" {}
17+
variable "two" {}
18+
19+
resource "validation_errors" "errs" {
20+
21+
error {
22+
condition = var.one == var.two
23+
summary = "var.one and var.two must never be equal"
24+
details = <<EOF
25+
When var.one and var.two are equal, bad things can happen.
26+
Please use differing values for these inputs.
27+
var.one: ${var.one}
28+
var.two: ${var.two}
29+
EOF
30+
}
31+
32+
error {
33+
condition = var.one % 2 == 0
34+
summary = "var.one cannot be even"
35+
}
36+
37+
error {
38+
condition = var.two % 2 != 0
39+
summary = "var.two cannot be odd"
40+
}
41+
}
42+
```
1443

1544
<!-- schema generated by tfplugindocs -->
1645
## Schema

docs/resources/warnings.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,36 @@ description: |-
1010

1111
Causes one or more warnings to be shown during execution if the condition is true.
1212

13+
## Example Usage
1314

15+
```terraform
16+
variable "one" {}
17+
variable "two" {}
18+
19+
resource "validation_warnings" "warns" {
20+
21+
warning {
22+
condition = var.one == var.two
23+
summary = "var.one and var.two are equal. This will cause an error in future versions"
24+
details = <<EOF
25+
In a future release of this code, var.one and var.two may no longer be equal.
26+
Please consider modifying the values to avoid execution failures.
27+
var.one: ${var.one}
28+
var.two: ${var.two}
29+
EOF
30+
}
31+
32+
warning {
33+
condition = var.one % 2 == 0
34+
summary = "var.one should not be even"
35+
}
36+
37+
warning {
38+
condition = var.two % 2 != 0
39+
summary = "var.two should not be odd"
40+
}
41+
}
42+
```
1443

1544
<!-- schema generated by tfplugindocs -->
1645
## Schema

0 commit comments

Comments
 (0)