I am using terraform v0.12.6
and I run into many errors like:
Error: Error creating Security Group: InvalidGroup.Duplicate: The security group \'sec
Change property "name" to "name_prefix" solved to me, and doesn't duplicate any roles and/or policies.
Yes. All duplicates should be imported into terraform and each resource's import may be different.
To import security group sg-903004f8
to terraform resource aws_security_group.elb_sg
using your dev
profile. You'll need to find the security group id of security-search-populate
security group.
AWS_PROFILE=dev terraform import aws_security_group.elb_sg sg-903004f8
To import IAM role PopulateTaskRole
to terraform resource aws_iam_role.developer
using your dev
profile.
AWS_PROFILE=dev terraform import aws_iam_role.developer PopulateTaskRole
After these are imported, you can do a targetted terraform plan to see the differences between what's in source controlled terraform and what's upstream in AWS
AWS_PROFILE=dev terraform plan \
-target aws_security_group.elb_sg \
-target aws_iam_role.developer