当我运行命令时,terraform apply发生以下错误,因为角色已存在:
Error: Error creating IAM Role iam_for_lambda: EntityAlreadyExists: Role with name iam_for_lambda already exists.
status code: 409, request id: 204c6c00-0b1d-4fb9-bf9c-fca48c67d669
on main.tf line 1, in resource "aws_iam_role" "iam_for_lambda":
1: resource "aws_iam_role" "iam_for_lambda" {
Run Code Online (Sandbox Code Playgroud)
我可以使用技巧来检查该角色是否已经存在而不会出现错误吗?
我正在使用terraform v0.12.6,但遇到了许多错误,例如:
Error: Error creating Security Group: InvalidGroup.Duplicate: The security group 'security-search-populate' already exists for VPC 'vpc-003e06e33a87c22f5'
status code: 400, request id: 82acdc81-c324-4672-b9fe-531eb8283ed3
Error: Error creating IAM Role PopulateTaskRole: EntityAlreadyExists: Role with name PopulateTaskRole already exists.
status code: 409, request id: 49aac94c-d52b-11e9-a535-c19e5ed20660
Run Code Online (Sandbox Code Playgroud)
我知道我可以通过从 aws 中删除这些资源来解决它们。但我想知道是否有更好的方法来解决它们。