hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.88k stars 454 forks source link

Support Chalice #516

Open ducva opened 3 years ago

ducva commented 3 years ago

As you known, Chalice support package in terraform format, ref: https://aws.github.io/chalice/topics/tf.html

Do we have any way to import the chalice.tf.json file, and use terraform cdk to create resources and the lambda functions?

skorfmann commented 3 years ago

That's an interesting suggestion, I wasn't aware that Chalice can generate Terraform config as well.

Do we have any way to import the chalice.tf.json file, and use terraform cdk to create resources and the lambda functions?

By importing you mean, being able to reference the resources generated by Chalice via the JSON output? So, essentially generating Typescript constructs out of the JSON?

ducva commented 3 years ago

By importing you mean, being able to reference the resources generated by Chalice via the JSON output? So, essentially generating Typescript constructs out of the JSON?

In my imagination: I can parse the chalice.tf.json and manipulate these resources.

Is there any way to create a resource from JSON format? I know Terraform also support JSON format, so support parsing JSON to resources may not only useful for chalice but also other cases too.

skorfmann commented 3 years ago

By importing you mean, being able to reference the resources generated by Chalice via the JSON output? So, essentially generating Typescript constructs out of the JSON?

In my imagination: I can parse the chalice.tf.json and manipulate these resources.

Is there any way to create a resource from JSON format? I know Terraform also support JSON format, so support parsing JSON to resources may not only useful for chalice but also other cases too.

There's no way to do this at the moment. However, that's certainly an interesting use-case which I could see to be quite valuable. That's something which would be needed for https://github.com/hashicorp/terraform-cdk/issues/231 as well.