16.03.2017 Views

The Terraform Book

TheTerraformBook_sample

TheTerraformBook_sample

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: Building an application stack with <strong>Terraform</strong><br />

Listing 3.42: <strong>The</strong> vpc module’s variables<br />

variable "name" {<br />

description = "<strong>The</strong> name of the VPC."<br />

}<br />

variable "cidr" {<br />

description = "<strong>The</strong> CIDR of the VPC."<br />

}<br />

variable "public_subnet" {<br />

description = "<strong>The</strong> public subnet to create."<br />

}<br />

variable "enable_dns_hostnames" {<br />

description = "Should be true if you want to use private DNS<br />

within the VPC"<br />

default = true<br />

}<br />

variable "enable_dns_support" {<br />

description = "Should be true if you want to use private DNS<br />

within the VPC"<br />

default = true<br />

}<br />

You can see that we’ve defined a number of variables. Some of the variables will<br />

be required: name, cidr, and public_subnet. <strong>The</strong>se variables currently have no<br />

defaults, so we must specify a value for each of them. We’ve specified the values<br />

in the module block in our web.tf file. This represents the incoming API for the<br />

vpc module.<br />

Version: v1.1.1 (e771e4d) 32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!