I am new to Terraform and I am trying to run a Terraform template from a Go application. However, I have noticed that there have been recent changes made to the Terraform core, including the introduction of the plugin and SDK framework, and the way in which Terraform templates are executed from Go applications. Can you please provide some guidance on the best library, and approach to follow for running Terraform templates from Go applications? Thank you.”
What exactly do you mean by “Terraform template”?
Are you using “template” as an unusual way to refer to an entire Terraform configuration?
Or are you referring to the built-in templating language available in strings and the
I don’t think it is intended or supported that either of these be embedded in another Go application as a library.
The supported way to interact with Terraform is to execute the
Apologies if my previous question was unclear. What I meant by a terraform template is a terraform configuration file written in YAML that is used to create resources on AWS.
I am attempting to use the terraform-exec Go library to programmatically run the terraform configuration file from my Go application. I would like to know if this is the recommended approach or if there are any other alternatives to programmatically triggering the terraform configuration to create resources on AWS.
Thank you for your time.
But Terraform configurations are not written in YAML.
I am not personally familiar with that library, but it seems a perfectly reasonable approach. Just executing Terraform using the standard command execution functionality in the Go standard library would also be fine.