Closed adamdrozdz closed 5 years ago
I was wondering if there's any progress on this.
I actually tried to do this myself using these instructions: https://www.terraform.io/docs/extend/terraform-0.12-compatibility.html And what I did was essentially:
git clone https://github.com/radekg/terraform-provisioner-ansible.git
cd terraform-provisioner-ansible
go get github.com/hashicorp/terraform@v0.12.0
go mod edit -replace=github.com/satori/go.uuid@v1.2.0=github.com/satori/go.uuid@master
go mod tidy
make build-linux
And I had a build that seems to work with 0.12.0
, but I'm not sure if I'm not missing any bugs due to changes in the Go API for Terraform.
The go.uuid
upgrade was due to these errors:
mode/mode_local.go:289:54: not enough arguments in call to uuid.Must
have (uuid.UUID)
want (uuid.UUID, error)
mode/mode_local.gohttps://www.terraform.io/docs/extend/terraform-0.12-compatibility.html:303:55: not enough arguments in call to uuid.Must
have (uuid.UUID)
want (uuid.UUID, error)
...
BTW, I find it weird that this repo doesn't have go.mod
and go.sum
committed. It's a good practice.
Also, the scripts from bin
fail if you don't change the shebang to use bash
instead of sh
, otherwise you'll get this on some linux flavours:
./bin/check-golang-version.sh 2: set: Illegal option -o pipefail
Okay, I found my first issue, it's with the extra_vars
argument for plays
block.
If I define it as an argument with extra_vars = { STUFF }
I get:
Error: error while validating the provisioner, reason: interface conversion: interface {} is []interface {}, not []map[string]interface {}
But if I use the extra_vars { STUFF }
block format I get:
Error: Unsupported block type
Blocks of type "extra_vars" are not expected here. Did you mean to define
argument "extra_vars"? If so, use the equals sign to assign it a value.
So I assume this is some kind of change related to variable syntax, probably described in: https://www.terraform.io/docs/extend/terraform-0.12-compatibility.html#configuration-syntax-changes
What they say is that:
If you see an error like the following from your tests after upgrading, adding the missing equals sign is usually the answer.
I would expect the issue to be here: https://github.com/radekg/terraform-provisioner-ansible/blob/4c0a828073ae133567260a050de07e2dada50617/types/defaults.go#L13 Or here: https://github.com/radekg/terraform-provisioner-ansible/blob/4c0a828073ae133567260a050de07e2dada50617/types/defaults.go#L72-L76
@ulm0 Oh, I guess I'm retarded because I didn't check PRs. Thanks for the link!
Files changed 8,267
Sweet Evil Step-dancing Zombie Jesus.
Now I see why go.mod
and go.sum
are not committed to the repo. Everything is in vendor
folder.
I always though that's ugly as all hell, but to each their own.
Implemented in https://github.com/radekg/terraform-provisioner-ansible/pull/129. This will be release before 1st of August 2019.
Steps to reproduce
Run command in current directory where ansible provisioner is used
terraform 0.12upgrade
Expected behavior
The
terraform 0.12upgrade
command applies several automatic upgrade rules to help prepare a module that was written for Terraform v0.11 to be used with Terraform v0.12.. By default,0.12upgrade
changes configuration files in the current working directory. ...Actual behavior
Error: failed to load provisioner "ansible": Incompatible API version with plugin. Plugin version: 4, Client versions: [5]
...Configuration
Terraform version: 0.12 terraform-provisioner-ansible version/SHA: v2.2.0 Terraform file / provisioner configuration:
Terraform run log: