使用Archive_file作为资源
当我运行Terraform脚本时,我收到了此消息:
Warning: Deprecated Resource
using archive_file as a resource is deprecated; consider using the data source instead
问题是我该怎么做?我试图阅读有关数据源的信息,但尚未清楚任何内容。
我在lambda定义中使用Archive_file来zing我的lambda源并获取目标zip哈希。
resource "archive_file" "archive_csv_validate" {
type = "zip"
source_dir = "lambda/csv-validate"
output_path = "artifacts/csv-validate.zip"
}
resource "aws_lambda_function" "lambda_csv_validate_function" {
function_name = "csv-validate"
filename = archive_file.archive_csv_validate.output_path
source_code_hash = archive_file.archive_csv_validate.output_base64sha256
handler = "main.main"
role = aws_iam_role.lambda_iam_role.arn
runtime = "python3.9"
timeout = 900
}
I got this message when I run my terraform script:
Warning: Deprecated Resource
using archive_file as a resource is deprecated; consider using the data source instead
The question is how should I do this? I tried to read about the data source, but it didn't clear anything.
I use archive_file in lambda definition for zipping my lambda source and getting target zip hash.
resource "archive_file" "archive_csv_validate" {
type = "zip"
source_dir = "lambda/csv-validate"
output_path = "artifacts/csv-validate.zip"
}
resource "aws_lambda_function" "lambda_csv_validate_function" {
function_name = "csv-validate"
filename = archive_file.archive_csv_validate.output_path
source_code_hash = archive_file.archive_csv_validate.output_base64sha256
handler = "main.main"
role = aws_iam_role.lambda_iam_role.arn
runtime = "python3.9"
timeout = 900
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在,Archive_file是数据源。
您可以这样转换您的代码:
Archive_file is now a data source.
You can transform your code as this: