Skip to content

Commit efc5671

Browse files
committed
docs: fix HCL escaping documentation in template
The escaping examples were incorrect about the interaction between HCL and CNPG operator placeholder expansion. Both systems use `$${...}` as the escape sequence that produces a literal `${...}`, and `$$` without a following `{` is kept as-is. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 52e2a48 commit efc5671

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

templates/metadata.hcl.tmpl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ metadata = {
6262
# `env`: Optional map of environment variables to be injected into the
6363
# PostgreSQL process for this extension.
6464
#
65-
# NOTE: Because HCL uses `${}` for its own interpolation, you must escape the
66-
# '$' sign for any value intended for the CNPG operator.
65+
# NOTE: Both HCL and the CNPG operator use `${...}` for placeholder
66+
# expansion. In both systems, `$${...}` is the escape that produces a
67+
# literal `${...}` in the output (`$$` without a following `{` is kept
68+
# as-is).
6769
#
68-
# 1. CNPG Placeholders: Use `$${}` to pass a placeholder to the operator.
70+
# 1. CNPG Placeholders: Use `$${...}` to pass a placeholder through HCL
71+
# to the operator, which then expands it.
6972
# Example: { "LIB_PATH" = "$${image_root}/lib" }
70-
# -> Result in Postgres: LIB_PATH=/extensions/my-extension/lib
73+
# HCL output: ${image_root}/lib -> Operator expands to the mount path
7174
#
72-
# 2. Literal Values: Use `$$${}` if you need a literal `${}` to appear in
73-
# the final environment variable without being expanded by the operator.
75+
# 2. Literal `${...}`: Use `$$${...}` so that HCL produces `$${...}`,
76+
# which the operator then treats as a literal `${...}`.
7477
# Example: { "TOKEN_FORMAT" = "$$${value}" }
75-
# -> Result in Postgres: TOKEN_FORMAT=${value}
78+
# HCL output: $${value} -> Operator produces literal: ${value}
7679
#
7780
# 3. Static Values: No special escaping needed.
7881
# Example: { "DEBUG" = "true" }

0 commit comments

Comments
 (0)