Jam*_*bla 6 lambda zip module terraform
我正在尝试使用 terraform 部署 lambda。lambda 模块中的步骤之一会压缩 lambda 的源文件夹。但是,当我运行以下代码时,我遇到了此错误:
Error: error archiving directory: could not archive missing directory: ./../hello-world
这是我当前的文件夹结构
这是我的 zip 步骤的 lambda terraform:
data "archive_file" "lambda_hello_world" {
type = "zip"
source_dir = "${path.root}/../hello-world"
output_path = "${path.root}/../hello-world.zip"
}
Run Code Online (Sandbox Code Playgroud)
管道代码:
name: Deploy Infrastructure
on:
push:
branches:
- master
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
defaults:
run:
working-directory: './terraform/'
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
# terraform_version: 0.13.0
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Format
id: fmt
run: terraform fmt -check
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: terraform plan -no-color
continue-on-error: true
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
run: terraform apply -auto-approve
Run Code Online (Sandbox Code Playgroud)