ilyesedina / Terraform

12 hands on labs from a Terraform course to improve my skills
0 stars 0 forks source link

Sync issue between devices / TF code - AWS UI [Troubleshooting] #13

Closed ilyesedina closed 8 months ago

ilyesedina commented 8 months ago

When I run terraform apply on my own computer, then run it on another PC, it doesn't recognize that the resources have been created.

The same issue occurs when I make changes on the AWS UI; it doesn't necessarily track the differences. For example, I added a tag under an EC2 instance, but it didn't show up in the terminal when running terraform plan -refresh-only

Video 41 Please review and let me know if any further adjustments are needed.

ilyesedina commented 8 months ago

On one of the VPC the changes has been recognized, and on the other one it wasn't. Root cause: The two VPC uses two different state file.

dkEdiIly commented 8 months ago

This issue has accrued now at the second time. Error message:

│ Error: creating EC2 VPC: VpcLimitExceeded: The maximum number of VPCs has been reached.
│       status code: 400, request id: 0685.. 
│
│   with aws_vpc.vpc,
│   on main.tf line 6, in resource "aws_vpc" "vpc":
│    6: resource "aws_vpc" "vpc" {

On the Aws Console I can see multiple resource created with the same name: demo_vpc Last time I have manually removed the some of the vpc,

Possible errors: