![](/img/trans.png)
[英]Elastic Beanstalk: Can't read file pulled from S3 within node.js application
[英]Can I deploy an Elastic Beanstalk application from a local ZIP file not a S3 object with Terraform?
有沒有辦法使用 Terraform 基於本地 ZIP 文件部署 AWS Elastic Beanstalk Node.js 應用程序?
我見過的所有例子都是基於 S3 的。
到目前為止,這是我的代碼:
resource "aws_iam_policy" "nodejs" {
name = "NodeJSPolicy"
policy = file("policy.json")
}
resource "aws_iam_role" "nodejs" {
name = "iam_for_lambda"
assume_role_policy = file("assumerole.json")
}
resource "aws_iam_role_policy_attachment" "nodejs" {
policy_arn = aws_iam_policy.nodejs.arn
role = aws_iam_role.nodejs.name
}
data "archive_file" "package"{
type = "zip"
source_file = "../app"
output_path = "../build/package.zip"
}
resource "aws_elastic_beanstalk_application" "nodejs" {
name = "nodejs-app"
description = "Noodle JP Application"
}
resource "aws_elastic_beanstalk_application_version" "nodejs" {
name = "v0.01"
application = aws_elastic_beanstalk_application.nodejs.name
//**??????? HOW CAN I HAVE THE SOURCE HERE?**
}
resource "aws_elastic_beanstalk_environment" "nodejs" {
application = aws_elastic_beanstalk_application.nodejs.name
name = "noodle-jp"
solution_stack_name = "Node.js 14 AL2 version 5.4.6"
}
有沒有辦法使用 Terraform 基於本地 ZIP 文件部署 AWS Elastic Beanstalk Node.js 應用程序?
不,Terraform 目前不支持此功能。
aws_elastic_beanstalk_application_version
Terraform 資源是用於指向應用程序源包的資源。
它僅將bucket
& key
作為S3 存儲桶名稱和S3 對象名稱參數用於定義源。
bucket
-(必需)包含應用程序版本源包的 S3 存儲桶。
key
-(必需)S3 對象,即應用程序版本源包。
它不支持定義本地路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.