Search code examples
amazon-web-servicesamazon-ec2terraformaws-security-group

Terraform plan says it needs to make changes even though I haven't made any to my AWS EC2 instance


I recently created some new resources with terraform .70 and right after running the apply I run terraform plan again and it says this needs to happen but I haven't made any changes to my main.tf file:

security_groups.#: "0" => "1" (forces new resource)
security_groups.2319596366: "" => "sg-8a7679ec" (forces new resource)

I ran terraform apply again (on a test instance) just to see what it would do and it terminates my original AWS ec2 instance server and creates a new one (good thing I didn't do this in production)...

Is this a bug or am I doing something wrong?


Solution

  • Looks like .70 fixed a bug with security groups and now I have to specify security groups with vpc_security_group_ids. I replaced security_groups with vpc_security_group_ids and it is not showing any changes are needed now.