可以使用 Terraform 作为 Go 库来运行吗?

huangapple go评论124阅读模式
英文:

Run Terraform as a Go Library?

问题

我一直在使用Terratest来测试我的所有Go模块,并且非常喜欢它作为通过Go编程语言运行terraform并与terraform基础架构进行交互的工具。然而,Terratest的设计是与go test框架集成,而不是作为自己的Go应用程序,而这正是我的目标。

在快速搜索中,我发现Terranova可以实现这一点,但它已经过时了。是否有人创建了类似Terratest的当前的Go库?或者是否有一种好的方法将terraform作为Go库运行,而不是作为命令的包装器?

英文:

I've been using Terratest to test all my go modules and absolutely love it as a means for running terraform and interacting with terraform infrastructure through the go programming language. However, terratest is designed to be integrated with the go test framework, not as a Go application of its own, which would be my goal.

Doing a quick search to find terraform go libraries I found Terranova does this, but is outdated. Is there a go library that someone has created currently that's similar to Terratest? Or is there a good way to run terraform as a go library instead of as a wrapper for the commands?

答案1

得分: 2

有一个用于在Go程序中运行Terraform的HashiCorp库,称为terraform-exec

然而,这个库是一个用于运行Terraform CLI的包装器,因为这是与Terraform进行编程集成的唯一支持方式。Terraform CLI是一个应用程序,而不是一个库。

英文:

There is a HashiCorp library for running Terraform from Go programs called terraform-exec.

However, this library is a wrapper for running Terraform CLI, because that is the only supported way to integrate programmatically with Terraform. Terraform CLI is an application, not a library.

huangapple
  • 本文由 发表于 2021年5月24日 00:56:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/67662284.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定