英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论