atlantis: Bug: [Docker] Custom Terraform plugins not found on plan

I have a custom Terraform plugin at ${workspace}/terraform.d/plugins/linux_amd64/terraform-provider-errorcheck_v1.1.5. The plugin is found during init, but during plan I get the following error

exit status 1: running "version=$(git rev-parse --short HEAD); [[ -z \"${version}\" ]] && { echo '$version is not set' ; exit 1; }; PATH=/home/atlantis/.atlantis/bin:$PATH terraform${ATLANTIS_TERRAFORM_VERSION} plan -input=false -no-color -out ${PLANFILE} -var nginx_container_version=${version} -var php_container_version=${version} -var-file=\"$(source ../../.atlantis/workspaceselect.sh).tfvars\"\n" in "/home/atlantis/.atlantis/repos/rateco/rateco.ca/227/default/terraform/app": 

Error: Failed to instantiate provider "errorcheck" to obtain schema: fork/exec /home/atlantis/.atlantis/repos/rateco/rateco.ca/227/default/terraform/app/terraform.d/plugins/linux_amd64/terraform-provider-errorcheck_v1.1.5: no such file or directory



Switched to workspace "test".

atlantis.yaml:

version: 3
automerge: true
projects:
  - name: app
    dir: terraform/app
    terraform_version: v0.12.2
    autoplan:
      when_modified:
        - "**"
        - "../../code/**"
        - "../modules/**"
      enabled: true
    workflow: app

workflows:
  app:
    plan:
      steps:
        - run: rm -rf .terraform
        - init:
            extra_args: [-backend-config=backend.tfvars]
        - run: >
            PATH=/home/atlantis/.atlantis/bin:$PATH            
            terraform${ATLANTIS_TERRAFORM_VERSION} workspace select -no-color "$(source ../../.atlantis/workspaceselect.sh)"
        - init:
            extra_args: [-backend-config=backend.tfvars]
        - run: >
            version=$(git rev-parse --short HEAD);
            [[ -z "${version}" ]] && { echo '$version is not set' ; exit 1; };
            PATH=/home/atlantis/.atlantis/bin:$PATH
            terraform${ATLANTIS_TERRAFORM_VERSION} plan -input=false -no-color
            -out ${PLANFILE}
            -var nginx_container_version=${version}
            -var php_container_version=${version}
            -var-file="$(source ../../.atlantis/workspaceselect.sh).tfvars"
  

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 26 (11 by maintainers)

Most upvoted comments

For what it’s worth I finally solved my issue by changing

RUN cd terraform-provider-pypiserver && go install

to

RUN cd terraform-provider-pypiserver && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"'

which seems to have solved my issue. On my Mac I cannot run strace in the Atlantis Docker image so I could not find what was the missing library.

👍 I’m going to close this for now. If it looks like this is a bug with Atlantis I’ll re-open.

Hey Scott, so I can reproduce the issue just by running terraform in a linux Docker image. So I don’t think the bug is with Atlantis at all.

docker run -v $(pwd):/tf -it --rm --entrypoint=sh hashicorp/terraform:latest
cd /tf
rm -rf .terraform
terraform init

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.errorcheck: version = "~> 1.1"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
/tf # terraform plan

Error: Failed to instantiate provider "errorcheck" to obtain schema: fork/exec /tf/terraform.d/plugins/linux_amd64/terraform-provider-errorcheck_v1.1.5: no such file or directory

ls /tf/terraform.d/plugins/linux_amd64/terraform-provider-errorcheck_v1.1.5
/tf/terraform.d/plugins/linux_amd64/terraform-provider-errorcheck_v1.1.5