<p>Terraform use <a href="https://github.com/golang/protobuf" rel="nofollow noreferrer">protobuf</a> to store the plans according to <a href="https://github.com/hashicorp/terraform/blob/master/plans/planfile/tfplan.go#L287" rel="nofollow noreferrer">its code</a></p>

<blockquote>
  <p>// writeTfplan serializes the given plan into the protobuf-based format used<br>
  // for the "tfplan" portion of a plan file.</p>
</blockquote>

<p>You can find <a href="https://github.com/hashicorp/terraform/blob/master/plans/internal/planproto/planfile.pb.go" rel="nofollow noreferrer">here</a> the code generating the plan file.</p>

<p>So in brief that's a binary file with a serialized version of what to do in a portable format (protocol buffers) for which you find more information <a href="https://developers.google.com/protocol-buffers" rel="nofollow noreferrer">here</a></p>

CC BY-SA 4.0
2018-12-14T12:54:16.670Z
still I am not sure I understand the path from say for Apache CS createVPC() to the buffer. Do they describe ressources as models? Okay but then, which part is the actual client of the API doing the call? Or do the APIs also talk the protocol buffer format as well besides REST API?
Ta Mu
CC BY-SA 4.0
2018-12-14T12:57:49.737Z
No, that's just a configuration file, what calls the API is still terraform, think of it like base64 encoding, it's just a way to store objects to be easily reloaded later
Tensibai
CC BY-SA 4.0
2018-12-14T11:09:00.190Z
2018-12-14T11:09:00.190Z
Tensibai
<p>If you export a Terraform plan, it is a binary file.</p>

<p>Now, calls to a cloud management interface are HTTP calls following corresponding REST APIs. </p>

<p>Does this mean this internal Terraform format somehow encodes these calls through some enumerations? </p>

<p>Like, given in the plan it would be, "B#3$1$2" which then translate "call the API function we have given number 3 passing values 1 and 2 as arguments"? </p>

<p>How does it work?</p>

<terraform>
Understanding contents and workwise of a Terraform plan
Ta Mu
# Understanding contents and workwise of a Terraform plan

(Asked by: username_0 on 2018-12-14)

If you export a Terraform plan, it is a binary file.

Now, calls to a cloud management interface are HTTP calls following corresponding REST APIs.

Does this mean this internal Terraform format somehow encodes these calls through some enumerations?

Like, given in the plan it would be, "B#3$1$2" which then translate "call the API function we have given number 3 passing values 1 and 2 as arguments"?

How does it work?

**Tags:** terraform


---

## 1 answers

### Answer by username_1 on 2018-12-14. Score: 1 | Accepted answer

Terraform use [protobuf](https://github.com/golang/protobuf) to store the plans according to [its code](https://github.com/hashicorp/terraform/blob/master/plans/planfile/tfplan.go#L287)

> // writeTfplan serializes the given plan into the protobuf-based format used  
> // for the "tfplan" portion of a plan file.

You can find [here](https://github.com/hashicorp/terraform/blob/master/plans/internal/planproto/planfile.pb.go) the code generating the plan file.

So in brief that's a binary file with a serialized version of what to do in a portable format (protocol buffers) for which you find more information [here](https://developers.google.com/protocol-buffers)

> **Comments:**
> **username_0**: still I am not sure I understand the path from say for Apache CS createVPC() to the buffer. Do they describe ressources as models? Okay but then, which part is the actual client of the API doing the call? Or do the APIs also talk the protocol buffer format as well besides REST API?  
> **username_1**: No, that's just a configuration file, what calls the API is still terraform, think of it like base64 encoding, it's just a way to store objects to be easily reloaded later  

---

