AgPipeline / openstack-terraform-nomad

Set up a Nomad cluster on OpenStack using Terraform
MIT License
6 stars 4 forks source link

Problem: Collaboration on infrastructure is hard #7

Closed julianpistorius closed 1 year ago

julianpistorius commented 5 years ago

You should consider using a backend with remote state capability, possibly one that supports workspaces, so your laptop isn't the central hub for infrastructure work. This will enable teams to collaborate as well as house your statefile someplace safe. Terraform Cloud offers this for free if you don't have a suitable backend available.

Originally posted by @nathanhruby in https://github.com/terraref/terraref-terraform/pull/1#issuecomment-519564786

julianpistorius commented 5 years ago

More info about Terraform Cloud:

julianpistorius commented 5 years ago

Currently when you apply the Terraform configuration it generates a 'state file', a giant JSON file with the last known state of the infrastructure:

Screen Shot 2019-08-30 at 15 16 23

Screen Shot 2019-08-30 at 15 17 19

You're not supposed to commit this file to Git, but you do need to share this file with other members of the team who are collaborating on the same infrastructure. Remote state management is a way to achieve this easily and securely.

From the blog post linked above:

Remote State Management

State files in Terraform capture the existing state of provisioned infrastructure for a given workspace. These files are used by Terraform to ensure that it properly creates or destroys infrastructure with respect to infrastructure that already exists.

For existing users of Terraform Open Source, state files are stored on machines locally by default. That means collaborating on Infrastructure with a team member involves carefully sharing that file and ensuring that team members update each other when they’ve made changes. That motion gets more complex as both number of state files/workspaces and number of collaborators grow.

Today we’re introducing remote state management with Terraform Cloud. This feature allows users to use Terraform Cloud as a remote backend to store and manage state files. With Terraform Cloud remote state management, individual users no longer need to maintain local state files and teams no longer need to carefully share or manage those files. Terraform Cloud will automatically handle everything.