Skip to content

Commit

Permalink
fix(docs): include code examples
Browse files Browse the repository at this point in the history
Includes code examples for new resources in the provider documentation, which is a step I missed
when publishing the previous release.
  • Loading branch information
tlkamp committed Jan 1, 2024
1 parent 8813888 commit c23195d
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/data-sources/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,36 @@ description: |-

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

## Example Usage

```terraform
variable "one" {}
variable "two" {}
data "validation_errors" "errs" {
error {
condition = var.one == var.two
summary = "var.one and var.two must never be equal"
details = <<EOF
When var.one and var.two are equal, bad things can happen.
Please use differing values for these inputs.
var.one: ${var.one}
var.two: ${var.two}
EOF
}
error {
condition = var.one % 2 == 0
summary = "var.one cannot be even"
}
error {
condition = var.two % 2 != 0
summary = "var.two cannot be odd"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
29 changes: 29 additions & 0 deletions docs/data-sources/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,36 @@ description: |-

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

## Example Usage

```terraform
variable "one" {}
variable "two" {}
data "validation_warnings" "warns" {
warning {
condition = var.one == var.two
summary = "var.one and var.two are equal. This will cause an error in future versions"
details = <<EOF
In a future release of this code, var.one and var.two may no longer be equal.
Please consider modifying the values to avoid execution failures.
var.one: ${var.one}
var.two: ${var.two}
EOF
}
warning {
condition = var.one % 2 == 0
summary = "var.one should not be even"
}
warning {
condition = var.two % 2 != 0
summary = "var.two should not be odd"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
29 changes: 29 additions & 0 deletions docs/resources/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,36 @@ description: |-

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

## Example Usage

```terraform
variable "one" {}
variable "two" {}
resource "validation_errors" "errs" {
error {
condition = var.one == var.two
summary = "var.one and var.two must never be equal"
details = <<EOF
When var.one and var.two are equal, bad things can happen.
Please use differing values for these inputs.
var.one: ${var.one}
var.two: ${var.two}
EOF
}
error {
condition = var.one % 2 == 0
summary = "var.one cannot be even"
}
error {
condition = var.two % 2 != 0
summary = "var.two cannot be odd"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
29 changes: 29 additions & 0 deletions docs/resources/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,36 @@ description: |-

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

## Example Usage

```terraform
variable "one" {}
variable "two" {}
resource "validation_warnings" "warns" {
warning {
condition = var.one == var.two
summary = "var.one and var.two are equal. This will cause an error in future versions"
details = <<EOF
In a future release of this code, var.one and var.two may no longer be equal.
Please consider modifying the values to avoid execution failures.
var.one: ${var.one}
var.two: ${var.two}
EOF
}
warning {
condition = var.one % 2 == 0
summary = "var.one should not be even"
}
warning {
condition = var.two % 2 != 0
summary = "var.two should not be odd"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down

0 comments on commit c23195d

Please sign in to comment.