简体   繁体   English

将 Terraform 作为 Go 库运行?

[英]Run Terraform as a Go Library?

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. 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.但是,terratest 旨在与 go 测试框架集成,而不是作为自己的 Go 应用程序,这将是我的目标。

Doing a quick search to find terraform go libraries I found Terranova does this, but is outdated.快速搜索以找到 terraform go 库我发现 Terranova 可以这样做,但是已经过时了。 Is there a go library that someone has created currently that's similar to Terratest?目前是否有人创建了类似于 Terratest 的 go 库? Or is there a good way to run terraform as a go library instead of as a wrapper for the commands?或者有没有一种好方法可以将 terraform 作为 go 库而不是作为命令的包装器运行?

There is a HashiCorp library for running Terraform from Go programs called terraform-exec .有一个 HashiCorp 库,用于从名为terraform-exec的 Go 程序运行 Terraform 。

However, this library is a wrapper for running Terraform CLI, because that is the only supported way to integrate programmatically with Terraform.但是,此库是运行 Terraform CLI 的包装器,因为这是以编程方式与 Terraform 集成的唯一受支持方式。 Terraform CLI is an application, not a library. Terraform CLI 是一个应用程序,而不是一个库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM