terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Failed to load plugin schemas - terraform show in offline mode

Open amiros89 opened this issue 2 years ago • 1 comments

Terraform Version

[15:10:31.326] 2023-12-05T15:10:31.326Z [INFO]  Terraform version: 1.3.6

Terraform Configuration Files

cat << EOF > ~/.terraformrc
provider_installation {
  network_mirror {
    url    = "[https://${user}:${password}@<nexus-host>/repository/tf-hosted/](https://$%7buser%7d:$%7bpassword%7d@<nexus-host>/repository/tf-hosted/)"
            include=["registry.terraform.io/*/*"]
            }
  direct{
           exclude=["registry.terraform.io/*/*"]
}
}
plugin_cach_dir="$HOME/.terraform.d/plugin-cache"
EOF

Debug Output

15:10:31.326Z [DEBUG] using github.com/hashicorp/go-tfe v1.9.0
[15:10:31.326] 2023-12-05T15:10:31.326Z [DEBUG] using github.com/hashicorp/hcl/v2 v2.15.0
[15:10:31.326] 2023-12-05T15:10:31.326Z [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
[15:10:31.326] 2023-12-05T15:10:31.326Z [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
[15:10:31.326] 2023-12-05T15:10:31.326Z [DEBUG] using github.com/zclconf/go-cty v1.12.1
[15:10:31.326] 2023-12-05T15:10:31.326Z [INFO]  Go runtime version: go1.19.3
[15:10:31.326] 2023-12-05T15:10:31.326Z [INFO]  CLI args: []string{"/storage/367f74a/usr/bin/terraform", "show", "-json", "/storage/367f74a/workspace/terraform.plan"}
[15:10:31.326] 2023-12-05T15:10:31.326Z [DEBUG] Attempting to open CLI config file: /root/.terraformrc
[15:10:31.326] 2023-12-05T15:10:31.326Z [INFO]  Loading CLI configuration from /root/.terraformrc
[15:10:31.327] 2023-12-05T15:10:31.326Z [DEBUG] Explicit provider installation configuration is set
[15:10:31.327] 2023-12-05T15:10:31.327Z [INFO]  CLI command args: []string{"show", "-json", "/storage/367f74a/workspace/terraform.plan"}
[15:10:31.331] 2023-12-05T15:10:31.331Z [DEBUG] checking for provisioner in "."
[15:10:31.331] 2023-12-05T15:10:31.331Z [DEBUG] checking for provisioner in "/storage/367f74a/usr/bin"
[15:10:31.331] ╷
[15:10:31.331] │ Error: Failed to load plugin schemas
[15:10:31.331] │ 
[15:10:31.331] │ Error while loading schemas for plugin components: 3 problems:
[15:10:31.331] │ 
[15:10:31.331] │ - Failed to obtain provider schema: Could not load the schema for provider
[15:10:31.331] │ registry.terraform.io/hashicorp/archive: failed to instantiate provider
[15:10:31.331] │ "registry.terraform.io/hashicorp/archive" to obtain schema: unavailable
[15:10:31.331] │ provider "registry.terraform.io/hashicorp/archive".
[15:10:31.331] │ - Failed to obtain provider schema: Could not load the schema for provider
[15:10:31.331] │ registry.terraform.io/hashicorp/aws: failed to instantiate provider
[15:10:31.331] │ "registry.terraform.io/hashicorp/aws" to obtain schema: unavailable
[15:10:31.331] │ provider "registry.terraform.io/hashicorp/aws".
[15:10:31.331] │ - Failed to obtain provider schema: Could not load the schema for provider
[15:10:31.331] │ registry.terraform.io/hashicorp/random: failed to instantiate provider
[15:10:31.331] │ "registry.terraform.io/hashicorp/random" to obtain schema: unavailable
[15:10:31.331] │ provider "registry.terraform.io/hashicorp/random"..
[15:10:31.331] ╵

Expected Behavior

terraform show should output the plan as expected

Actual Behavior

terraform show fails to load plugin schema although terraform init works as expected in offline mode as well as plan, we have a working plan output but need it in json format. We have no internet access from where we execute terraform.

Steps to Reproduce

  1. configure terraform to work in "offline mode" using .terraformrc and point it to private repository (we're using nexus).
  2. terraform init
  3. terraform plan >
  4. terraform show -json

Additional Context

No response

References

No response

amiros89 avatar Dec 06 '23 09:12 amiros89

Got the same with Github Actions Cache...

- Failed to obtain provider schema: Could not load the schema for provider
│ registry.terraform.io/hashicorp/archive: failed to instantiate provider
│ "registry.terraform.io/hashicorp/archive" to obtain schema: unavailable
│ provider "registry.terraform.io/hashicorp/archive".

marcellodesales avatar May 27 '25 18:05 marcellodesales