Getting started with go getter
This post is a small example of how to use Hashicorp’s go-getter. This package allows you to pull files easily from GCS, GIT or S3. I’ll explain a bit about my use case below. I assume you know about Hashicorp and golang and looking for a clean example to get started. For the past few weeks, I’ve written designs for a delivery system using Hashi(Hashicorp) tools such as Consul for keys and service discovery, Vault for dynamic secrets, and Terraform to create and modify infrastructure resources. I’m determining where I should store Terraform files and directories. I’m experimenting allowing clients to commit Terraform folders to a repository such as git or s3. Committing a Terraform directory creates a new infrastructure request to eventually get to the terraform apply
phase. This may also provide a testing path to test out new terraform modules, upgrades, etc. The create request will clone the folder to a remote server and run terraform init
, terraform plan
, terraform apply
. Below is an example of using the โGitGetterโ for retrieving a subdirectory of a git repository using go-getter. This package is also an easier interface to git commands instead of dealing with the c binding for the git2go package. I haven’t read through all the code, however I believe go-getter clones the entire respoitory in memory and then returns you the directories you specify. In Part two I will add an example of invoking Terraform directly using it’s packages.
|
|