github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/website/intro/examples/index.html.markdown (about)

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