jonmorehouse / terraform-provisioner-ansible

A provisioner for bootstrapping terraform resources with ansible
526 stars 68 forks source link

Incompatible API version with plugin #30

Open kostyrev opened 7 years ago

kostyrev commented 7 years ago
cd example/
terraform plan
Error configuring: 1 error(s) occurred:

* Incompatible API version with plugin. Plugin version: 2, Ours: 1
$ terraform -v
Terraform v0.7.9

Your version of Terraform is out of date! The latest version
is 0.7.11. You can update by downloading from www.terraform.io

Am I the only one with this error?

AndreaCrotti commented 7 years ago

Yep got the same error sadly @kostyrevaa

akerl commented 7 years ago

This seems to be caused by this commit: https://github.com/hashicorp/terraform/commit/b3124e16ca7efb6c543a84af8c7951860b3cfb37

They've bumped the number in the repo, so things built against HEAD of terraform will be version 2.

AndreaCrotti commented 7 years ago

Ah thanks @akerl Can I recompile it myself somehow otherwise in the meanwhile?

cocoy commented 7 years ago

@AndreaCrotti we're you able to recompile it? Or any instructions how to recompile this? thanks.

kostyrev commented 7 years ago

@cocoy Here are instructions how to recompile on Fedora 24 box

$ vagrant init fedora/24-cloud-base; vagrant up --provider virtualbox
$ vagrant ssh default
[vagrant@localhost ~]$ sudo dnf install go -y
[vagrant@localhost ~]$ mkdir -p $HOME/work
[vagrant@localhost ~]$ echo 'export GOPATH=$HOME/work' >> $HOME/.bashrc
[vagrant@localhost ~]$  source $HOME/.bashrc
[vagrant@localhost ~]$ go env | grep GOPATH
GOPATH="/home/vagrant/work"
[vagrant@localhost ~]$ go env | grep GOROOT
GOROOT="/usr/lib/golang"
[vagrant@localhost ~]$ sudo dnf install git -y
[vagrant@localhost ~]$ cd $GOPATH
[vagrant@localhost work]$ mkdir {src,pkg,bin}
[vagrant@localhost work]$ cd src/
[vagrant@localhost src]$ git clone https://github.com/jonmorehouse/terraform-provisioner-ansible
[vagrant@localhost src]$ cd terraform-provisioner-ansible/
[vagrant@localhost terraform-provisioner-ansible]$ go get -v
[vagrant@localhost terraform-provisioner-ansible]$ go build

after build you'll find binary in $GOPATH/bin/

cocoy commented 7 years ago

Thanks @kostyrevaa

boznius commented 7 years ago

@akostyrev

Tried your method a few minutes ago , but it errors out maybe something connected with the Go version ?

[vagrant@localhost terraform-provisioner-ansible]$ go get -v package context: unrecognized import path "context" (import path does not begin with hostname) [vagrant@localhost terraform-provisioner-ansible]$ pwd /home/vagrant/work/src/terraform-provisioner-ansible [vagrant@localhost terraform-provisioner-ansible]$ go version go version go1.6.4 linux/amd64 [vagrant@localhost terraform-provisioner-ansible]$ pwd /home/vagrant/work/src/terraform-provisioner-ansible [vagrant@localhost terraform-provisioner-ansible]$ ll total 79756 -rwxrwxr-x. 1 vagrant vagrant 5377 Mar 26 14:02 ansible-local.py drwxrwxr-x. 4 vagrant vagrant 4096 Mar 26 14:02 example -rw-rw-r--. 1 vagrant vagrant 81618401 Sep 7 2016 go1.7.1.linux-amd64.tar.gz -rw-rw-r--. 1 vagrant vagrant 226 Mar 26 14:02 Godeps -rw-rw-r--. 1 vagrant vagrant 336 Mar 26 14:02 main.go -rw-rw-r--. 1 vagrant vagrant 5306 Mar 26 14:29 provisioner.go -rw-rw-r--. 1 vagrant vagrant 945 Mar 26 14:02 provisioner_test.go -rw-rw-r--. 1 vagrant vagrant 2647 Mar 26 14:02 README.md -rw-rw-r--. 1 vagrant vagrant 3108 Mar 26 14:02 resource_provisioner.go -rw-rw-r--. 1 vagrant vagrant 1103 Mar 26 14:02 resource_provisioner_test.go -rw-rw-r--. 1 vagrant vagrant 45 Mar 26 14:02 version.go [vagrant@localhost terraform-provisioner-ansible]$

Let me know how i can build this for myself , are there any official requirements list or supported versions of Go or anything else ?

Thanks in advance !

kostyrev commented 7 years ago

@bbozhev according to this Go version 1.8+ is required to build terraform sources. You could try to use

curl -o fedora-rawhide.box https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/CloudImages/x86_64/images/Fedora-Cloud-Base-Vagrant-Rawhide-20170326.n.0.x86_64.vagrant-virtualbox.box
vagrant box add fedora-rawhide ./fedora-rawhide.box
vagrant init fedora-rawhide

Update: it seems that rawhide box does not boot up. So you'll have to figure out how to install go1.8 in distro of your choice or use docker image.

boznius commented 7 years ago

@akostyrev thanks for the hint , but now i have the following issue : ` go version go1.8 darwin/amd64 boz@bdogs:[~/.go/src/terraform-provisioner-ansible]$ go get -v github.com/hashicorp/terraform (download) ......... github.com/hashicorp/terraform/plugin github.com/hashicorp/terraform/communicator terraform-provisioner-ansible

terraform-provisioner-ansible

./main.go:9: cannot use ResourceProvisioner literal (type ResourceProvisioner) as type terraform.ResourceProvisioner in return argument: ResourceProvisioner does not implement terraform.ResourceProvisioner (missing Stop method) boz@bdogs:[~/.go/src/terraform-provisioner-ansible]$ go build

terraform-provisioner-ansible

./main.go:9: cannot use ResourceProvisioner literal (type ResourceProvisioner) as type terraform.ResourceProvisioner in return argument: ResourceProvisioner does not implement terraform.ResourceProvisioner (missing Stop method) `

I have the same error on fedora with :

./main.go:9: cannot use ResourceProvisioner literal (type *ResourceProvisioner) as type terraform.ResourceProvisioner in return argument: *ResourceProvisioner does not implement terraform.ResourceProvisioner (missing Stop method) [vagrant@localhost terraform-provisioner-ansible]$ go version go version go1.8 linux/amd64

Does anything come to your mind ?

kostyrev commented 7 years ago

@bbozhev no idea