Skip to content

Commit

Permalink
Docs improvements for wait feature. (#2354)
Browse files Browse the repository at this point in the history
Docs improvements for  wait feature of `kubernetes_manifest`
---------

Co-authored-by: Brian McClain <brianmmcclain@gmail.com>
  • Loading branch information
alexsomesan and BrianMMcClain authored Nov 29, 2023
1 parent 74e8435 commit bf5dfec
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions website/docs/r/manifest.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ The following arguments are supported:
- `computed_fields` - (Optional) List of paths of fields to be handled as "computed". The user-configured value for the field will be overridden by any different value returned by the API after apply.
- `manifest` (Required) An object Kubernetes manifest describing the desired state of the resource in HCL format.
- `object` (Optional) The resulting resource state, as returned by the API server after applying the desired state from `manifest`.
- `wait_for` (Optional) An object which allows you configure the provider to wait for certain conditions to be met. See below for schema. **DEPRECATED: use `wait` block**.
- `wait` (Optional) An object which allows you configure the provider to wait for specific fields to reach a desired value or certain conditions to be met. See below for schema.
- `wait_for` (Optional, Deprecated) An object which allows you configure the provider to wait for certain conditions to be met. See below for schema. **DEPRECATED: use `wait` block**.
- `field_manager` (Optional) Configure field manager options. See below.

### `wait`
Expand All @@ -232,7 +233,26 @@ The following arguments are supported:

- `rollout` (Optional) When set to `true` will wait for the resource to roll out, equivalent to `kubectl rollout status`.
- `condition` (Optional) A set of condition to wait for. You can specify multiple `condition` blocks and it will wait for all of them.
- `fields` (Optional) A map of fields and a corresponding regular expression with a pattern to wait for. The provider will wait until the field matches the regular expression. Use `*` for any value.
- `fields` (Optional) A map of field paths and a corresponding regular expression with a pattern to wait for. The provider will wait until the field's value matches the regular expression. Use `*` for any value.

A field path is a string that describes the fully qualified address of a field within the resource, including its parent fields all the way up to "object". The syntax of a path string follows the rules below:
* Fields of objects are addressed with `.`
* Keys of a map field are addressed with `["<key-string>"]`
* Elements of a list or tuple field are addresed with `[<index-numeral>]`

The following example waits for Kubernetes to create a ServiceAccount token in a Secret, where the `data` field of the Secret is a map.
```hcl
wait {
fields = {
"data[\"token\"]" = ".+"
}
}
```
You can use the [`type()`]() Terraform function to determine the type of a field. With the resource created and present in state, run `terraform console` and then the following command:
```hcl
> type(kubernetes_manifest.my-secret.object.data)
map(string)
```

### `wait_for` (deprecated, use `wait`)

Expand Down

0 comments on commit bf5dfec

Please sign in to comment.