Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hclField cannot handle object or nested object #666

Open
xingao267 opened this issue Dec 3, 2020 · 2 comments
Open

hclField cannot handle object or nested object #666

xingao267 opened this issue Dec 3, 2020 · 2 comments
Labels
good first issue Good for newcomers

Comments

@xingao267
Copy link
Member

xingao267 commented Dec 3, 2020

For example

In Terraform Engine config:

notification_config = {
   pubsub_topic = "projects/example-prod-data/topics/example-topic"
}

with {{hclField . "notification_config" -}}

will be turned to

notification_config = pubsub_topic = "projects/example-prod-data/topics/example-topic"

and with more complicated struct, for example

stream_configs = [{
  bigquery_destination = {
    dataset_uri = "bq://example-prod-data.example_dataset_id"
    schema_config = {
      recursive_structure_depth = 3
    }
  }
}]

with with {{hclField . "stream_configs" -}}

will be turned to

stream_configs = [
  {
    bigquery_destination {
      dataset_uri = "bq://example-prod-data.example_dataset_id"

      schema_config {
        recursive_structure_depth = 3
      }
    }
  },
]
@xingao267
Copy link
Member Author

It would be very useful to make hclField more powerful to handle complex struct so the effort of support a new field in Terraform resource or module can be largely reduced, i.e. just adding {{hclField . "new_field" -}} in the template and allow that field as an object in the schema.

@umairidris
Copy link
Member

We could add support ourselves. Right now it just calls the lib https://github.com/rodaine/hclencoder so there isn't much we can do, apart from adding support there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants