
[英]How to attach AWS Lambda fn to EXISTING vpc using terraform?
[英]Provision existing AWS lambda using Terraform
我正在学习 terraform,并被要求在 gitlab 为 CI/CD 管道提供它。 我的疑问是,
假设 lambda function 已经在运行/运行。 如何使用 terraform 进行配置? 我应该使用数据块来消耗正在运行的 aws lambda 吗? 或者这不是它的工作方式。 我不确定我们该怎么做。 我搜索了不支持此用例的文档。
因此,对于已经运行的 Lambda function,基本上这里有两个用例:
terraform import aws_lambda_function.my_lambda existing_lambda_function_name
Note: Please note that the my_lambda function is your terraform block of code that is defining the exact Lambda that is already running, this is to match the existing resource with your code Terraform, to then be added to the state. 我希望这很清楚
data "aws_lambda_function" "existing_lambda" {
function_name = var.function_name
}
在您的代码中的其他地方,您可以按如下方式使用它:
function_name = data.aws_lambda_function.existing_lambda
我希望这可以帮到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.