问题
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