Terraform does not support some resource types although the document says so

C:>Terraform version
==>
Terraform v0.12.28

  • provider.aws v2.18.0

C:> Terraform import aws_lambda_permission.my_lambda_permission
==> Error: resource aws_lambda_permission doesn’t support import

C:> Terraform import aws_secretsmanager_secret_rotation.my-secret-rotation
==> Error: unknown resource type: aws_secretsmanager_secret_rotation

1 Like

Hello @gyang909,

Do you have any examples or code that would be okay to share? That way, I could help add some more insight to this issue.

Sincerely,

Taylor Dolezal

Hi Taylor,

You can verify by the Terraform import commands in my initial post, or more specifically,

C:>terraform import aws_lambda_permission.my_lambda_permission

C:>terraform import aws_secretsmanager_secret_rotation.my-secret-rotation

It’s possible that the current AWS provider version doesn’t support them. Hope V3 will support.

Thanks,
Gary Yang

1 Like

Thank you for clarifying, @gyang909 -

Import syntax for those resources are available as shown below. Let me know if you need anything else on this front!

Lambda permission statements can be imported using function_name/statement_id, with an optional qualifier, e.g.

$ terraform import aws_lambda_permission.test_lambda_permission my_test_lambda_function/AllowExecutionFromCloudWatch

$ terraform import aws_lambda_permission.test_lambda_permission my_test_lambda_function:qualifier_name/AllowExecutionFromCloudWatch

aws_secretsmanager_secret_rotation can be imported by using the secret Amazon Resource Name (ARN), e.g.

$ terraform import aws_secretsmanager_secret_rotation.example arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456

Helpful links

https://www.terraform.io/docs/providers/aws/r/lambda_permission.html
Terraform Registry