diff --git a/website/docs/language/functions/yamlencode.mdx b/website/docs/language/functions/yamlencode.mdx index 7ceddb746c..af2dba3bf9 100644 --- a/website/docs/language/functions/yamlencode.mdx +++ b/website/docs/language/functions/yamlencode.mdx @@ -8,23 +8,6 @@ description: The yamlencode function encodes a given value as a YAML string. `yamlencode` encodes a given value to a string using [YAML 1.2](https://yaml.org/spec/1.2/spec.html) block syntax. -~> **Warning:** This function is currently **experimental** and its exact -result format may change in future versions of Terraform, based on feedback. -Do not use `yamldecode` to construct a value for any resource argument where -changes to the result would be disruptive. To get a consistent string -representation of a value use [`jsonencode`](/language/functions/jsonencode) instead; its -results are also valid YAML because YAML is a JSON superset. - - - This function maps [Terraform language values](/language/expressions/types) to YAML tags in the following way: @@ -49,6 +32,15 @@ types, passing the `yamlencode` result to `yamldecode` will not produce an identical value, but the Terraform language automatic type conversion rules mean that this is rarely a problem in practice. +YAML is a superset of JSON, and so where possible we recommend generating +JSON using [`jsonencode`](/language/functions/jsonencode) instead, even if +a remote system supports YAML. JSON syntax is equivalent to flow-style YAML +and Terraform can present detailed structural change information for JSON +values in plans, whereas Terraform will treat block-style YAML just as a normal +multi-line string. However, generating YAML may improve readability if the +resulting value will be directly read or modified in the remote system by +humans. + ## Examples ```