This is more a set of conceptual things that I'm trying to wrap my head around when it comes to how Terraform works.
1) Here's a scenario. Lets say I create a simple plan that creates a couple machines in AWS. Init, apply, it builds the infrastructure and creates a local state file. Satisfied with the code, I push it up to github. My question here is should I also push up the state file? Without the state file, anyone who pulls down the code and tries to build the instances again won't have the state, so I assume terraform tries to build a new set of machines. But, a state file feels like residual data, and therefore should be gitignored.
2) Same scenario, but lets say the plan includes a setup file that implements an S3 backend. Does the same problem exist, or does any run of the plan honor the S3 backend's state?
3) Now, lets say that I want this plan to run as module in a larger plan that deploys an entire environment and stores its state file in S3. The module has already been run so there's already existing machines. Will running the module as part of a larger module act the same way as (1) since it uses the state file of the umbrella plan, or does it use its existing s3 state file?
4) Should backend setup be implemented as an independent module? My thinking is that if someone ever tries to run terraform destroy, they won't destroy the backend, just the infrastructure.
In general, I'm rather confused about the enterprise workflow of Terraform.