cloudposse / terraform-aws-tfstate-backend

Terraform module that provision an S3 bucket to store the `terraform.tfstate` file and a DynamoDB table to lock the state file to prevent concurrent modifications and state corruption.
https://cloudposse.com/accelerate
Apache License 2.0
408 stars 177 forks source link

Documentation is wrong #36

Closed baquick closed 4 years ago

baquick commented 4 years ago

in your steps 1 - 5, you state that you need to add the backend section.

You fail to indicate that it needs to be in a terraform node.

In addition, you fail to mention that the bucket referenced must already exist. I get this error:

Error: Error inspecting states in the "s3" backend: S3 bucket does not exist

osterman commented 4 years ago

Can you clarify what you mean by a “terraform node”?

The bucket is created by terraform in this module. You should not create the bucket by any other means.

Please note this module uses a bit of terraform “inception” to manage terraforms state bucket with terraform. Thus it’s a 2-phase process.

osterman commented 4 years ago

I think the problem you are having is that you define a s3 backend before creating the s3 backend. You’ll note that in the first backend section there is no reference to s3. That is deliberate. Then after applying, the bucket is created. Now we can update the backend section to add s3. After doing that, we need to rerun terraform init which will import the state.

This is a coldstart problem. Just needs to happen once.

baquick commented 4 years ago

Nope, this causes a whole bunch of problems.

proofofcorrectsteps

then I try and use the state in another folder, with no previous state, and I get this:

thenallthishappens

I tried skipping steps 4 and 5, thinking that worked, but then no state is saved....so since this change was made, I have now stuck. Been using this module for years with no problem...now I can't use it.

baquick commented 4 years ago

$ terraform --version Terraform v0.12.18

baquick commented 4 years ago

On Dec 2, 2019, I was able to use this module just fine. Had not had to create any infrastructure since then. Started yesterday....and this is what I ran into. was on v0.12.10 then as well..

baquick commented 4 years ago

If I skip steps 4 and 5, I do not get the above errors, but my state doesn't get stored either....

baquick commented 4 years ago

So I got thru that error, but now state is not being maintained between my folders...it says it is initializing the backend state, but it is not...

baquick commented 4 years ago

The state is not being saved...tried numerous efforts...whatever update was made to this module has rendered it un-useful...will have to find another way to maintain remote state

osterman commented 4 years ago

https://nolanlawson.com/2017/03/05/what-it-feels-like-to-be-an-open-source-maintainer/