Running a terraform plan command with the docker image of hashicorp results in this error:
$ docker run -it -v `pwd`:/terrascripts hashicorp/terraform plan /terrascripts
Unable to find image 'hashicorp/terraform:latest' locally
latest: Pulling from hashicorp/terraform
Digest: sha256:eab63752545a0295eedc1318da1d293126cce4689bcd4b139afe816da3f6fffb
Status: Downloaded newer image for hashicorp/terraform:latest
Error: Could not load plugin
Plugin reinitialization required. Please run "terraform init".
Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.
Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".
Failed to instantiate provider "registry.terraform.io/hashicorp/aws" to obtain
schema: unknown provider "registry.terraform.io/hashicorp/aws"
Looks like it is similar to this issue. I am using workspaces to refer to different environments. And it only happens when using terraform with the docker image. When using the binary, it works as expected.
Is there a way to overcome this problem when using the docker image hashicorp/terraform
?
question from:
https://stackoverflow.com/questions/65882461/terraform-error-could-not-load-plugin 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…