Terraform: `terraform show` missing schema for provider

Created on 26 May 2019  ·  11Comments  ·  Source: hashicorp/terraform

Terraform Version

$ terraform --version
Terraform v0.12.0
+ provider.aws v2.12.0

Terraform Configuration Files

Most likely only part of configuration should be enough

terraform {
  required_version = "~> 0.12.0"
}

provider "aws" {
  version             = "~> 2.12.0"
  allowed_account_ids = ["XXX"]
}

provider "aws" {
  alias               = "us-east-1"
  region              = "us-east-1"
  allowed_account_ids = [var.region_table["us-east-1"]["account_id"]]

  assume_role {
    role_arn = "arn:aws:iam::${var.region_table["us-east-1"]["account_id"]}:role/${var.assume_role_name}"
  }
}

module "vpc_us-east-1" {
  source = "./vpc"

  providers = {
    aws = aws.us-east-1
  }

  cidr_prefix  = var.region_table["us-east-1"]["cidr_prefix"]
  cidr_netmask = var.vpc_cidr_netmask
}

Debug Output

Crash Output

Expected Behavior

terraform show should print resources in proper manner

Actual Behavior

$ terraform show
# module.vpc_us-east-1.aws_default_route_table.rt: 
# missing schema for provider "aws.us-east-1"

# module.vpc_us-east-1.aws_route_table_association.subnets_rt[2]: 
# missing schema for provider "aws.us-east-1"

# module.vpc_us-east-1.aws_route_table_association.subnets_rt[3]: 
# missing schema for provider "aws.us-east-1"

(...)

Steps to Reproduce


Assuming we already have resources.

  • terraform init
  • terraform show
  • Additional Context

    I'm rewriting my 0.11 terraform files to 0.12 and my CI step for terraform show stopped working and now only shows missing schema for provider.

    I fail to find any information regarding that in docs so I call for some kind of bug or something is wrong with my code here - not sure.

    References

    bug cli v0.12

    Most helpful comment

    Hello all! I've merged a PR which will be included in the next release which fixes this issue. Thanks, and please don't hesitate to open a new issue if you still see any problems after the next release (0.12.20)

    There was one comment here that seemed to be describing a different root issue - @trawler, if you are still experiencing an issue with state show and a statefile path, can you please open a new github issue? I was unable to reproduce your problem, so we may need more information.

    All 11 comments

    I am seeing the same thing:

    provider "google" {                                                                                                                                                                                                
      alias       = "company_a"                                                                                                                                                                                    
      credentials = "./service-account.json"                                                                                                                                                                           
      region      = "us-east4"                                                                                                                                                                                         
      zone        = "us-east4-b"                                                                                                                                                                                       
      version     = "~> 2.12"                                                                                                                                                                                          
    } 
    
    $ terraform --version
    Terraform v0.12.6
    + provider.google v2.12.0
    + provider.random v2.2.0
    ╰─$ terraform show
    
    # module.clinical_mind_google_cloud.google_compute_network.vpc_network:
    # missing schema for provider "google.company_a"
    

    Is this not supposed to show the resources just because I've defined an alias for the provider?

    Same thing with the OCI provider:

    provider "oci" {
      alias            = "src"
      tenancy_ocid     = "${local.src-config["tenancy-id"]}"
      user_ocid        = "${local.src-config["user-id"]}"
      fingerprint      = "${var.fingerprint}"
      private_key_path = "${var.private_key_path}"
      region           = "${local.src-config["region"]}"
    }
    
    provider "oci" {
      alias            = "dst"
      tenancy_ocid     = "${local.dst-config["tenancy-id"]}"
      user_ocid        = "${local.dst-config["user-id"]}"
      fingerprint      = "${var.fingerprint}"
      private_key_path = "${var.private_key_path}"
      region           = "${local.dst-config["region"]}"
    }
    
    
    $ terraform -v
    Terraform v0.12.6
    + provider.local v1.3.0
    + provider.null v2.1.2
    + provider.oci v3.38.0
    
    
    
    md5-75185d52b5946ae279f859178bb60fc8
    
    
    
    $ terraform show | head 
    # module.dst-bucket.data.oci_objectstorage_namespace.namespace:
    # missing schema for provider "oci.dst"
    
    # module.dst-bucket.oci_objectstorage_bucket.migration:
    # missing schema for provider "oci.dst"
    
    # module.dst-bucket.oci_objectstorage_preauthrequest.migration-write-par:
    # missing schema for provider "oci.dst"
    
    

    Seems that this happens when you use aliases for a provider. Also, if you try to delete these resources, (it works), but gives an error that:

    Error: Missing required argument
    The argument "region" is required, but was not set.
    

    This is happening on version:
    Terraform v0.12.9

    • provider.aws v2.29.0

    I found that it's happening also on my environment, when using the -state=path flag to write a state file with different naming convention other than the default terraform.tfstate:

    ➜ terraform version
    Terraform v0.12.12
    + provider.azurerm v1.35.0
    
    ➜ terraform show backend_terraform.tfstate
    # azurerm_resource_group.k8s:
    # missing schema for provider "azurerm"
    
    # azurerm_storage_account.tf-backend:
    # missing schema for provider "azurerm"
    
    # azurerm_storage_container.tf-storage-container:
    # missing schema for provider "azurerm"
    
    

    After copying the custom tfstate file to the default terraform.tfstate, suddenly terraform show works again.

    ➜ cp backend_terraform.tfstate terraform.tfstate
    ➜ terraform show backend_terraform.tfstate
    # azurerm_resource_group.k8s:
    resource "azurerm_resource_group" "k8s" {
        id       = "some_id"
        location = "az_location"
        name     = "resource_group_ name"
        tags     = {}
    }
    
    # azurerm_storage_account.tf-backend:
    resource "azurerm_storage_account" "tf-backend" {
        account_encryption_source         = "Microsoft.Storage"
        account_kind                      = "Storage"
        account_replication_type          = "LRS"
        account_tier                      = "Standard"
        account_type                      = "Standard_LRS"
        enable_advanced_threat_protection = false
        enable_blob_encryption            = true
        enable_file_encryption            = true
        enable_https_traffic_only         = false
        id                                = "some_id"
        is_hns_enabled                    = false
        location                          = "az_location"
        name                              = "storage_name"
        primary_access_key                = (sensitive value)
        primary_blob_connection_string    = (sensitive value)
        primary_blob_endpoint             = "blob_endpoint"
        primary_blob_host                 = "blob_host"
        primary_connection_string         = (sensitive value)
        primary_file_endpoint             = "file_endpoint"
        primary_file_host                 = "file_host"
        primary_location                  = "az_location"
        primary_queue_endpoint            =  (sensitive value)
        primary_queue_host                =  (sensitive value)
        primary_table_endpoint            =  (sensitive value)
        primary_table_host                =  (sensitive value)
        resource_group_name               =  (sensitive value)
        secondary_access_key              = (sensitive value)
        secondary_connection_string       = (sensitive value)
        tags                              = {
            "environment" = "dev"
        }
    
        queue_properties {
    
            hour_metrics {
                enabled               = true
                include_apis          = true
                retention_policy_days = 7
                version               = "1.0"
            }
    
            logging {
                delete                = false
                read                  = false
                retention_policy_days = 0
                version               = "1.0"
                write                 = false
            }
    
            minute_metrics {
                enabled               = false
                include_apis          = false
                retention_policy_days = 0
                version               = "1.0"
            }
        }
    }
    
    # azurerm_storage_container.tf-storage-container:
    resource "azurerm_storage_container" "tf-storage-container" {
        container_access_type   = "private"
        has_immutability_policy = false
        has_legal_hold          = false
        id                      =  (sensitive value)
        metadata                = {}
        name                    = "terraform-tfstate"
    ......
    
    }
    

    The only workaround I found for this so far, is to rename the custom named tfstate file to terraform.tfstate...

    Fails for me using GCP bucket as my remote store, and using workspaces other than default.

    As of v0.12.16, the issue still exists.

    Same thing on:
    Terraform v0.12.16

    • provider.aws v2.35.0

    State is in an S3 bucket.

    terraform show shows "missing schema for provider" on all objects that are created by "aliased" providers.

    terraform state show <resource> works though.

    Still in 0.12.17

    still in 0.12.18.

    # module.monitoring.google_monitoring_alert_policy.Production-Vault-Healthy:
    # missing schema for provider "google.staging"
    

    Hello all! I've merged a PR which will be included in the next release which fixes this issue. Thanks, and please don't hesitate to open a new issue if you still see any problems after the next release (0.12.20)

    There was one comment here that seemed to be describing a different root issue - @trawler, if you are still experiencing an issue with state show and a statefile path, can you please open a new github issue? I was unable to reproduce your problem, so we may need more information.

    I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

    If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

    Was this page helpful?
    0 / 5 - 0 ratings