Reputation: 10349
I'm using CDKTF to deploy the datadog helm chart into a kubernetes cluster. I'm trying to set a value for confd but the spaces in my typescript multiline string aren't being preserved. Here's how I'm setting the confd value in typescript
new helm.Release(this, "datadog-agent", {
chart: "datadog",
name: "datadog",
repository: "https://helm.datadoghq.com",
version: "3.1.3",
set: [
{
name: "clusterAgent.confd",
value: `postgres.yaml: |-
cluster_check: true
init_config:
instances:
\t- dbm: true
\t host: <redacted>
\t port: 5432
\t username: datadog
\t password: <redacted>
`
}
],
});
however, when I try to deploy this I see the following diff
+ set {
+ name = "clusterAgent.confd"
+ value = <<-EOT
postgres.yaml: |-
cluster_check: true
init_config:
instances:
- dbm: true
host: <redacted>
port: 5432
username: datadog
password: <redacted>
EOT
which makes it seem like all the spaces and tabs in the multiline string are being stripped.
How can I get CDKTF to preserve the spaces in my multiline string?
Upvotes: 0
Views: 1140
Reputation: 11921
While it's a bit hacky you could try to use something like this:
value: `postgres.yaml: |- ${
Fn.base64decode(
Buffer.from(
`cluster_check: true
init_config:
instances:
\t- dbm: true
\t host: <redacted>
\t port: 5432
\t username: datadog
\t password: <redacted>`
).toString('base64')
)
}
`
Where is Fn is imported from cdktf. The Fn function is executed at runtime, so during synth time you have your base64 encoded content which is safe from any manipulation that cdktf might accidentally do here.
Upvotes: 2