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

Error: Failed to load plugin schemas #355

Closed qrkourier closed 1 year ago

qrkourier commented 1 year ago

Describe the bug

I have not used this provider before, so I'm trying to get it working for the first time. Terraform will not run with the provider installed and required in the plan.

To Reproduce

  1. Install TF v1.3.9 in Linux amd64

  2. Create the filesystem install mirror

    mkdir -p ~/.terraform.d/plugins/terraform.netfoundry.io/openziti/openapi/3.0.0/linux_amd64
  3. Move provider release v3.0.0 to filesystem install mirror

    mv /tmp/terraform-provider-openapi_v3.0.0 \
        ~/.terraform.d/plugins/terraform.netfoundry.io/openziti/openapi/3.0.0/linux_amd64/terraform-provider-openapi
  4. Configure the provider

    # ~/.terraform.d/plugins/terraform-provider-openapi.yaml
    version: '1'
    services:
        mgmt:
            swagger-url: https://get.openziti.io/spec/management.yml
            insecure_skip_verify: false
  5. Require the provider in the TF plan

    openziti = {
      source  = "terraform.netfoundry.io/openziti/openapi"
      version = ">= 3.0.0"
    }
  6. Run TF

$  TF_CLOUD_ORGANIZATION=bingnet \
    TF_WORKSPACE=linode-lke-lab \
         terraform plan -var-file ./my.tfvars
╷
│ Error: Failed to load plugin schemas
│ 
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider
│ terraform.netfoundry.io/openziti/openapi: failed to instantiate provider "terraform.netfoundry.io/openziti/openapi" to obtain schema: Unrecognized remote plugin
│ message: 
│ 
│ This usually means that the plugin is either invalid or simply
│ needs to be recompiled to support the latest protocol...
╵

Expected behaviour

I expected terraform plan to succeed normally because I have only required the provider and not declared any resources or data sources yet.

Extra Context

Additionally, I reproduced this with a build from branch master by moving the artifact to a higher semver and running terraform init -upgrade before running plan.

Checklist (for admin only)

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

qrkourier commented 1 year ago

The problem was a mis-alignment of the key name under "services" in the plugin config file and the provider name.