SBaronda.com a little place I like to call home.


Better Solution to ESXi vim-cmd Parsing

Sep. 10, 2018

In my previous post about ESXi, I talked about starting a new project that would allow to provision a new machine in an automated way. Well, I ended up finding a solution that I can use directly from terraform :) in the form of a terraform provider plugin 🎉

While his build instructions could have worked for me, I found it easier to use the Go 1.11 method of using modules to build. Only one little issue that is pretty easy to fix.

$ echo "module terraform-provider-esxi" >> go.mod
$ go build
go: finding github.com/hashicorp/terraform/terraform latest
go: finding github.com/hashicorp/terraform/plugin latest
go: finding github.com/hashicorp/go-plugin latest
go: finding github.com/hashicorp/go-hclog latest
...
go: finding google.golang.org/genproto latest
build terraform-provider-esxi: cannot find module for path 
github.com/terraform-providers/terraform-provider-esxi/esxi

You'll get the error at the bottom. You can fix it via the diff below:


    1 package main
    2
    3 import (
+   4   "terraform-provider-esxi/esxi"
+   5
    6   "github.com/hashicorp/terraform/plugin"
_   7   "github.com/hashicorp/terraform/terraform"
    8 )

After that you can do a:

$ go build


comments powered by Disqus