terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Python - provider argument dict keys changed to lower-case with underscores

Open jantman opened this issue 1 year ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

cdktf-cli 0.15.5 Python 3.10.9 / cdktf 0.15.5

Affected Resource(s)

Grafana provider

Expected Behavior

Dictionary key arguments would be passed to provider configuration as specified.

Actual Behavior

Dictionary key arguments are lower-cased and have dashes converted to underscores, breaking them.

Steps to Reproduce

  1. Install cdktf latest version (0.15.5), generate bindings for grafana/grafana@~> 1.35 provider.
  2. Configure the provider with the http_headers argument, such as:
GrafanaProvider(
    self, 'grafana', org_id=1, http_headers={'X-Disable-Provenance': 'disabled'}
)
  1. The resulting synth'ed JSON has a header of x_disable_provenance instead of X-Disable-Provenance, which doesn't work with the underlying application.
  "provider": {
    "grafana": [
      {
        "http_headers": {
          "x_disable_provenance": "disabled"
        },
        "insecure_skip_verify": true,
        "org_id": 1,
        "url": "http://nuc1:3000/"
      }
    ]
  },

Important Factoids

This can currently be worked around with the add_override escape hatch.

References

It looks to me like this is related to #235 and #646 but I don't understand enough about the internals to really understand what's going on or why it works this way.

jantman avatar Feb 24 '23 22:02 jantman