github.com/bengesoff/terraform@v0.3.1-0.20141018223233-b25a53629922/website/source/intro/examples/index.html.markdown (about) 1 --- 2 layout: "intro" 3 page_title: "Example Configurations" 4 sidebar_current: "examples" 5 --- 6 7 # Example Configurations 8 9 These examples are designed to help you understand some 10 of the ways Terraform can be used. 11 12 All examples are ready to run as-is. Terraform will 13 ask for input of things such as variables and API keys. If you want to 14 conitnue using the example, you should save those parameters in a 15 "terraform.tfvars" file or in a `provider` config bock. 16 17 <div class="alert alert-block alert-warning"> 18 <div> 19 <strong>Note:</strong> The examples use real providers that launch 20 <em>real</em> resources. That means they can cost money to 21 experiment with. To avoid unexpected charges, be sure to understand the price 22 of resources before launching them, and verify any unneeded resources 23 are cleaned up afterwards.</div> 24 </div> 25 26 Experimenting in this way can help you learn how the Terraform lifecycle 27 works, as well as how to repeatedly create and destroy infrastructure. 28 29 If you're completely new to Terraform, we recommend reading the 30 [getting started guide](/intro/getting-started/install.html) before diving into 31 the examples. However, due to the intuitive configuration Terraform 32 uses it isn't required. 33 34 ## Examples 35 36 All of the examples are in the 37 ["examples" directory within the Terraform source code](https://github.com/hashicorp/terraform/tree/master/examples). Each example (as well as the examples 38 directory) has a README explaining the goal of the example. 39 40 To use these examples, Terraform must first be installed on your machine. 41 You can install Terraform from the [downloads page](/downloads.html). 42 Once installed, you can use two steps to view and run the examples. 43 44 To clone any examples, run `terraform init` with the URL to the example: 45 46 ``` 47 $ terraform init github.com/hashicorp/terraform/examples/aws-two-tier 48 ... 49 ``` 50 51 This will put the example files within your working directory. You can then 52 use your own editor to read and browse the configurations. This command will 53 not _run_ any code. 54 55 If you want to run the example, just run `terraform apply`: 56 57 ``` 58 $ terraform apply 59 ... 60 ``` 61 62 Terraform will interactively ask for variable input and potentially 63 provider configuration, and will start executing. 64 65 When you're done with the example, run `terraform destroy` to clean up.