atmos icon indicating copy to clipboard operation
atmos copied to clipboard

Intended method of configuring cluster_ca_certificate in Kubernetes provider / newlines not being preserved

Open DavidR91 opened this issue 3 months ago • 0 comments

Describe the Bug

I'm trying to dynamically configure a kubernetes provider to connect to a cluster, using the !terraform_output from other component

The trouble is, passing cluster_ca_certificate, the output is expected to be a PEM string with embedded newlines:

  • The certificate data I have is base64 encoded, and I can successfully decode it with gomplate - but then the string has the embedded \ns removed, so it's no longer a valid PEM.
  • I can't see a way to output 'raw' text e.g. so I could wrap the string with base64decode( ) so the decode happens in the Terraform rather than inside of atmos

Expected Behavior

Working flow for passing a base64 encoded PEM into cluster_ca_certificate of kubernetes provider without the \ns being stripped

Steps to Reproduce

Pseudocode (no base64):

providers:
    kubernetes:
        cluster_ca_certificate: !terraform.output management-cluster cluster_certificate_authority_data

With base64 decode:

providers:
    kubernetes:
        cluster_ca_certificate: '{{atmos.Component "management-cluster" .stack).outputs.cluster_certificate_authority_data | base64.Decode }}'

But this produces e.g:

"cluster_ca_certificate": "----- BEGIN CERTIFICATE----- MII.........

Note where there should be a newline after ----- it has instead been replaced with a space.

Manually escaping (e.g. with \\n) also does not have the intended effect, as \\n is just preserved verbatim in the output

Screenshots

No response

Environment

Linux x64, tofu v1.10.6, atmos 1.189.0

Additional Context

No response

DavidR91 avatar Sep 15 '25 16:09 DavidR91