Hello,
We are running into an error that we don't understand when running terraform plan and Terraform doesn't seem to see the existing resources and wants to (re)create almost everything:
Plan: 146 to add, 5 to change, 8 to destroy.
If we try and target one of these (existing) resources with e.g. terraform apply -target=module.logs_bucket.aws_s3_bucket.mod then AWS returns an error because the resource already exists.
Adding a totally new resource works as expected (targeting only that resource), and then immediately running terraform plan again doesn't plan anything for that resource, which is the correct behaviour.
Also, the state file refers to version 0.7.3 whereas I'm using 0.7.4 and my colleague 0.7.3. When we updated terraform in the past we usually had an error if one of us had already updated the state using a newer version of Terraform but this is not the case at the moment and both of us can run a plan (and get the same errors).
We are using an s3 remote state with Terragrunt but the behaviour is the same when using Terraform directly.
Before getting this error we had a bunch of the following errors:
* aws_s3_bucket_object.script: PreconditionFailed: Precondition Failed
status code: 412, request id: 8AC4EE3A8101C468
and the weird plan came after we emptied the buckets that were causing these errors.
We suspect we've put our Terraform state file in a corrupted err.. state but we can't figure out how this happened.
Has anyone ran into something similar? Any help would be highly appreciated!
Thanks,
Franck