mobfox / terraform-provider-multiverse

A Terraform Custom Provider to create a custom resource based on script
Mozilla Public License 2.0
47 stars 11 forks source link

Not compatible with Terraform 0.12 #1

Open pauldraper opened 5 years ago

pauldraper commented 5 years ago

Error: Failed to instantiate provider "multiverse" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]

jimmy-scott commented 4 years ago

I was able to migrate the code, but it doesn't seem to work as expected:

Anyway, whoever feels working on it:

   export GOPATH=$(pwd)
   export PATH="${PATH}:${GOPATH}/bin"
   cd src/github.com/mobfox/terraform-provider-multiverse
   go get github.com/hashicorp/tf-sdk-migrator
   go install github.com/hashicorp/tf-sdk-migrator
   rm -rf vendor
   go mod init
   go get github.com/hashicorp/terraform@v0.12.20
   go get github.com/hashicorp/terraform-plugin-sdk@v1.6.0
   tf-sdk-migrator check
   tf-sdk-migrator migrate
   make build
jacquev6 commented 4 years ago

@h0x91b-wix's fork seems to work with Terraform 0.12. FWIW I've added their fork to my infrastructure in this commit.

h0x91b commented 4 years ago

Yes, it's working, we are using it already here in wix, but I did some changes to API, please wait while I finish to document it and rewrite python example...

birchb1024 commented 4 years ago

I have a fork which now works with Terraform 0.13 and the plugin SDK 5. Added make install for the new local plugins layout.

my fork here

Also tweaked it so that the resource name can be anything you like, since the Provider gets it's binding from the binary name. example, here there are two copies of the binary,

/home/me/.terraform.d/
├── checkpoint_cache
├── checkpoint_signature
└── plugins
    ├── github.com
    │   └── mobfox
    │       ├── alpha
    │       │   └── 0.0.1
    │       │       └── linux_amd64
    │       │           └── terraform-provider-alpha
    │       └── multiverse
    │           └── 0.0.1
    │               └── linux_amd64
    │                   └── terraform-provider-multiverse
    ├── terraform-provider-alpha
    └── terraform-provider-multiverse
resource "multiverse" "h" {
  executor = "python3"
  script = "hello_world.py"
  id_key = "id"
  data = <<JSON
{
  "name": "test-terraform-test",
  "url" : "https://foo.bar.quux/",
  "created-by" : "Elvis Presley"
}
JSON
}

resource "alpha" "h" {
  executor = "python3"
  script = "hello_world.py"
  id_key = "id"
  data = <<JSON
{
  "name": "A strange alpha resource",
  "url" : "https://alpha.com/",
  "created-by" : "Winston Churchill",
  "subject" : "Painting

I'm still working on this fork, there's documents to update and more examples to add.

benishak commented 4 years ago

Thanks a lot @birchb1024 This is great.

birchb1024 commented 4 years ago

My fork is mostly ready to use. I've added a proper round trip in and out of TF for the data with many validations added. Unit/acceptance testing is a problem. The usual provider testing framework is so complicated :-( Anyhow I'll start to use my fork.

benishak commented 4 years ago

it's a pity, this git repo is no longer maintained, I was the creator and maintainer of this project but I left the company long time ago.

birchb1024 commented 4 years ago

I would like to rename my fork to 'universe', assuming the name is not already taken. Not least because GitHub forks cannot have their own issues. Mainly though because my fork is no longer compatible with multiverse. Is that OK? Does anyone object?

Especially want to hear from @benishak ?