Data.archive_file.lambda: data.archive_file.lambda: error archiving file: could not archive missing

circle.yml

#1

I am getting below error while running circleci.

  • data.archive_file.lambda: data.archive_file.lambda: error archiving file: could not archive missing file: switchboard.py

I have switchboard.py in my root directory and here is the content of config.yml
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/python:3.6.1

working_directory: ~/repo

steps:
  - checkout
  - run:
      name: install dependencies
      command: |
        python3 -m venv venv
        . venv/bin/activate
        pip install -r requirements.txt
        wget https://releases.hashicorp.com/terraform/0.10.2/terraform_0.10.2_linux_386.zip
        unzip terraform_0.10.2_linux_386.zip
        sudo mv terraform /usr/local/bin/
        sudo chmod 777 /usr/local/bin/
        export PATH=$PATH:/usr/local/bin/
        source ~/.bashrc
        terraform -v
        echo "export PATH=$PATH:/usr/local/bin/" >> ~/.bash_profile
        zip -r function.zip switchboard.py
        pushd pipeline && terraform init && terraform plan && terraform apply && popd

Here is the code of my terraform script:-
provider “aws” {
region = “us-east-1”
}

data “archive_file” “lambda” {
type = "zip"
source_file = "switchboard.py"
output_path = “lambda.zip”
}

resource “aws_lambda_function” “_airflow_request” {
filename = "{data.archive_file.lambda.output_path}" function_name = "_airflow_request" role = "{aws_iam_role.lambda_execution_role.arn}"
handler = "switchboard.handler"
runtime = "python3.6.0"
source_code_hash = “{base64sha256(file("{data.archive_file.lambda.output_path}”))}"
publish = true
}

#Role the lambda will be executed with
resource “aws_iam_role” “lambda_execution_role” {
name = "lambda_exec_role"
assume_role_policy = <<EOF
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Action”: “sts:AssumeRole”,
“Principal”: {
“Service”: “lambda.amazonaws.com
},
“Effect”: “Allow”
}
]
}
EOF
}

please suggest why it is failing.


#2

issue resolved…good to close.


#3