<p>I am trying to mount a Kubernetes secret via a <code>kubernetes_manifest</code> like this, however, <code>port</code> is a number <code>5342</code></p>
<pre><code>resource &quot;kubernetes_manifest&quot; &quot;test&quot; {
  manifest = {
    &quot;apiVersion&quot; = &quot;secrets-store.csi.x-k8s.io/v1alpha1&quot;
    &quot;kind&quot;       = &quot;SecretProviderClass&quot;
    &quot;metadata&quot; = {
      namespace = &quot;test-namespace&quot;
      &quot;name&quot;    = &quot;test&quot;
    }
    &quot;spec&quot; = {
      &quot;provider&quot; = &quot;aws&quot;
      &quot;secretObjects&quot; = [{
        &quot;secretName&quot; = &quot;test&quot;
        &quot;type&quot;       = &quot;Opaque&quot;
        data = [{
          &quot;objectName&quot; = &quot;test123&quot;
          &quot;key&quot;        = &quot;port&quot;
        }
]
      }]
      &quot;parameters&quot; = {
        objects = yamlencode([{
          objectName  = aws_secretsmanager_secret.test.name
          objectType  = &quot;secretsmanager&quot;
          objectAlias = &quot;test&quot;
          jmesPath = [{
            path        = &quot;port&quot;
            objectAlias = &quot;test123&quot;
          }]
        }])
      }
    }
  }
}
</code></pre>
<p>When I <code>terraform apply</code> this, I get the error:</p>
<blockquote>
<p>err: rpc error: code = Unknown desc = Invalid JMES search result type for path:port. Only string is allowed</p>
</blockquote>
<p>Is there a way to mount <code>port</code> despite it being a number? Can I convert it to a string somehow?</p>

<p>JMESPath does have a <a href="https://jmespath.org/specification.html#to-string" rel="nofollow noreferrer"><code>to_string</code></a> function.</p>
<p>So, you can use a JMESPath query in the <code>path</code> field and do:</p>
<pre><code>path        = &quot;to_string(port)&quot;
</code></pre>
