How to import aws_lambda_permission in terraform

浪子不回头ぞ 提交于 2021-01-27 13:04:52

问题


How can I use terraform import with resources of type aws_lambda_permission in terraform? What should the second argument be?


回答1:


At the time of writing Terraform does not have an importer for this resource, so it's not possible to import it automatically using the terraform import command.

Since a Lambda permission is a subordinate resource belonging to a Lambda function, once there is support for importing it the most likely way it would be handled is to import it as a side-effect of importing the function itself; the id of the permission alone is not enough information to retrieve it.




回答2:


You can create the same permission with different statement_id, then remove the old lambda permission via aws cli:

aws lambda remove-permission --function-name myfunction --statement-id myoldfunctionsid



来源:https://stackoverflow.com/questions/43771086/how-to-import-aws-lambda-permission-in-terraform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!