dikhan / terraform-provider-openapi

OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)
Apache License 2.0
274 stars 48 forks source link

Incompatible provider version #345

Closed baridiloz closed 2 years ago

baridiloz commented 2 years ago

Describe the bug

Incompatible provider version

To Reproduce

Install the latest terraform-provider-openapi 3.0.0 from this repo

Steps to reproduce the behavior:

baridilo@Baridilos-MBP ~ % TF_LOG=DEBUG terraform init
2022-05-24T17:32:17.853+0200 [INFO]  Terraform version: 1.1.9
2022-05-24T17:32:17.853+0200 [INFO]  Go runtime version: go1.17.2
2022-05-24T17:32:17.853+0200 [INFO]  CLI args: []string{"terraform", "init"}
2022-05-24T17:32:17.853+0200 [DEBUG] Attempting to open CLI config file: /Users/baridilo/.terraformrc
2022-05-24T17:32:17.853+0200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-05-24T17:32:17.854+0200 [DEBUG] checking for credentials in "/Users/baridilo/.terraform.d/plugins"
2022-05-24T17:32:17.854+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-05-24T17:32:17.854+0200 [DEBUG] will search for provider plugins in /Users/baridilo/.terraform.d/plugins
2022-05-24T17:32:17.855+0200 [DEBUG] ignoring non-existing provider search directory /Users/baridilo/Library/Application Support/io.terraform/plugins
2022-05-24T17:32:17.855+0200 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2022-05-24T17:32:17.856+0200 [INFO]  CLI command args: []string{"init"}

Initializing the backend...
2022-05-24T17:32:17.861+0200 [DEBUG] New state was assigned lineage "d7a536ab-7598-23f3-9b8a-48c0ad09980a"
2022-05-24T17:32:17.862+0200 [DEBUG] checking for provisioner in "."
2022-05-24T17:32:17.863+0200 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2022-05-24T17:32:17.863+0200 [DEBUG] checking for provisioner in "/Users/baridilo/.terraform.d/plugins"

Initializing provider plugins...
- Finding terraform.example.com/examplecorp/myprovidername versions matching ">= 3.0.0"...
╷
│ Error: Incompatible provider version
│ 
│ Provider terraform.example.com/examplecorp/myprovidername v3.0.0 does not have a package available for your current platform, darwin_arm64.
│ 
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵

baridilo@Baridilos-MBP ~ % cat .terraform.d/plugins/terraform-provider-openapi.yaml 
version: '1'
services:
    myprovidername:
      swagger-url: https://my-openapi-url/openapi.json/ # removed the original url
baridilo@Baridilos-MBP ~ % tree .terraform.d/plugins
.terraform.d/plugins
├── terraform-provider-openapi.yaml
└── terraform.example.com
    └── examplecorp
        └── myprovidername
            └── 3.0.0
                └── darwin_amd64
                    └── terraform-provider-myprovidername

Expected behaviour

te

Example:

Scenario:
Given ...
When ...
Then ... 

Additional context

Add any other context about the problem here.

Checklist (for admin only)

Don't forget to go through the checklist to make sure the issue is created properly:

dikhan commented 2 years ago

Please ensure the plugin is installed in the expected terraform directory. In your example above you are running on arm64 architecture whereas the plugin seems to be installed in the darwin_amd64 directory.

So you will need to download the arm64 binary from the v3.0.0 release page and install the plugin under:

~/.terraform.d/plugins/terraform.example.com └── examplecorp └── myprovidername └── 3.0.0 └── darwin_arm64 └── terraform-provider-myprovidername

This is working as expected and once you have installed the plugin in the right path it should work. Pls feel free to re-open the issue if it does not.

Thanks Dani

baridiloz commented 2 years ago

Thank you so much. It works now. I did the following: Created directory(~/.terraform.d/plugins/terraform.example.com/examplecorp/myprovidername/3.0.0/darwin_arm64) place the arm64 binary in this directory, make it executable(chmod +x terraform-provider-openapi_v3.0.00) and rename the binary to terraform-provider-myprovidername. Terraform init was successful😊