why can't a tool like terraform check what resources are available in the Cloud by connecting with the Cloud instance in question? Why keep a record of reality when you could in principle examine the real thing?
I was confused about this too but I think I understand it now; The first time you provision your infrastructure, you will end up creating a bunch of resources with IDs. Terrform can only obtain that information and create a mapping to the terraform code once, so that it can use it to update and further change the SAME infrastructure again. Without this mapping terraform will craete new resources everytime you run terraform apply, without the state file, it will not have any way to UPDATE the existing infrastructure.
Well done, great explanation
thanx
Why can't the lock file also be created in the S3 bucket? Not fast enough?
Can I used same terraform state file to create resources in different regions. Pl answer Thanks in advance. 🙏
try to import the state file.
why can't a tool like terraform check what resources are available in the Cloud by connecting with the Cloud instance in question? Why keep a record of reality when you could in principle examine the real thing?
I was confused about this too but I think I understand it now;
The first time you provision your infrastructure, you will end up creating a bunch of resources with IDs. Terrform can only obtain that information and create a mapping to the terraform code once, so that it can use it to update and further change the SAME infrastructure again. Without this mapping terraform will craete new resources everytime you run terraform apply, without the state file, it will not have any way to UPDATE the existing infrastructure.