title: terraform - access remote state outputs from command line
body: <p>I'm currently setting up a project where my Terraform state is split into multiple remote-states (core, database, vpc, etc), and all of these are split by environment as well.  I store these all in an <code>infrastructure</code> git repo, where all of my terraform state for all of services and infrastructure are managed. This includes core building blocks, as well as separate state that are needed for particular services.</p>
  
  <p>My question is: can i access the variables from those remote states (core, database, etc) without git-checking-out the projects from which those states were created?  ie. from the command-line?</p>
  
  <p>Here's an example structure.</p>
  
  <p>git repos:</p>
  
  <ul>
  <li>service_1
  
  <ul>
  <li>application code</li>
  <li>dockerfile </li>
  </ul></li>
  <li>infrastructure
  
  <ul>
  <li>terraform
  
  <ul>
  <li>global</li>
  <li>production
  
  <ul>
  <li>vpc</li>
  <li>db</li>
  <li>service_1</li>
  </ul></li>
  <li>staging
  
  <ul>
  <li>vpc</li>
  <li>db</li>
  <li>service_1</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>So if im writing glue scripts in my <code>service_1</code> project, and need access to something from the <code>database</code> remote state (which was created by terraform in the <code>infrastructure</code> project, can i access that data without git-checking-out the <code>infrastructure</code> project, running <code>terraform init</code>, etc?</p>
  
  <hr>
  
  <p>EDIT: updating with more specific use-cases per the comments</p>
  
  <p>Currently, I use Terraform to setup some basic infrastructure in the <code>core</code> module, which has it's own remote state.  This sets up Internet Gateways, VPCs, NAT Gateways, Subnets, etc.  I then store these as outputs in the state.</p>
  
  <p>Once the core is up, I use <code>kops</code> to setup Kubernetes clusters.  To setup the clusters, i need the VPC IDs, Internet Gateways, Availability Zones, etc, which is why I want to access them in the Terraform Output</p>