terraform-aws-lambda icon indicating copy to clipboard operation
terraform-aws-lambda copied to clipboard

Pipeline - unable to build in docker

Open mliner opened this issue 3 years ago β€’ 2 comments

Description

I have a CI/CD pipeline created in Bitbucket. I want to create a package (build in docker) and deploy it. However I am getting the following issue (might apply to Github actions as well):

β”‚ Error running command
β”‚ 'builds/b18acc5a06f2696c9788ce422024d46dd8aad9c0f34d4c5b44b66585ad81d7cd.plan.json':
β”‚ exit status 1. Output: zip: creating
β”‚ 'builds/b18acc5a06f2696c9788ce422024d46dd8aad9c0f34d4c5b44b66585ad81d7cd.zip'
β”‚ archive
β”‚ Installing python requirements:
β”‚ modules/lambda-delete-default-resources/src/requirements.txt
β”‚ > mktemp -d terraform-aws-lambda-XXXXXXXX #
β”‚ /tmp/terraform-aws-lambda-2zn5r3x_
β”‚ > cd /tmp/terraform-aws-lambda-2zn5r3x_
β”‚ > docker run --rm -v /tmp/terraform-aws-lambda-2zn5r3x_:/var/task:z -v
β”‚ /root/.ssh/known_hosts:/root/.ssh/known_hosts:z
β”‚ lambci/lambda:build-python3.8 /bin/sh -c 'python3.8 -m pip install
β”‚ --no-compile --prefix= --target=. --requirement=requirements.txt && chown
β”‚ -R 0:0 .'
β”‚ docker: Error response from daemon: authorization denied by plugin
β”‚ pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories.

This means that docker command is trying to access folder not available in bitbucket pipeline. Locally on my laptop it is working without any issues. When I did a small code check I can see in package.py that you are always adding this inpiut into docker_cmd https://github.com/terraform-aws-modules/terraform-aws-lambda/blob/master/package.py#:~:text=home%20%3D%20os.environ,%5D)

However for cases when you don't want to use SSH including .ssh/known_hosts is not required correct?

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Terraform: 1.0.1
  • Provider(s): provider registry.terraform.io/hashicorp/aws v3.45.0 provider registry.terraform.io/hashicorp/external v2.1.0 provider registry.terraform.io/hashicorp/local v2.1.0 provider registry.terraform.io/hashicorp/null v3.1.0 provider registry.terraform.io/hashicorp/random v3.1.0 provider registry.terraform.io/kreuzwerker/docker v2.14.0
  • Module: 2.7.0

Reproduction

Steps to reproduce the behavior:

NO

Code Snippet to Reproduce

Expected behavior

It should be able to build the package and deploy the software to AWS. Locally working without any issues.

Actual behavior

Terminal Output Screenshot(s)

Additional context

mliner avatar Jul 15 '21 11:07 mliner

I am running into a similar issue with github actions. I ran into this on localhost ubuntu 20.04 as well, but was able to work-around it by running apply twice, the first would always fail and the second would work.

Ranchman42 avatar Sep 28 '21 04:09 Ranchman42

I created #352 which makes it possible to handle volume problems.

mwiede avatar Oct 12 '22 17:10 mwiede