github.com/salme4/terraform@v0.11.12-beta1/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  The examples in this section illustrate 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  Our examples are distributed across several repos. [This README file in the Terraform repo has links to all of them.](https://github.com/hashicorp/terraform/tree/master/examples)
    35  
    36  To use these examples, Terraform must first be installed on your machine.
    37  You can install Terraform from the [downloads page](/downloads.html).
    38  Once installed, you can download, view, and run the examples.
    39  
    40  To use an example, clone the repository that contains it and navigate to its directory. For example, to try the AWS two-tier architecture example:
    41  
    42  ```
    43  git clone https://github.com/terraform-providers/terraform-provider-aws.git
    44  cd terraform-provider-aws/examples/two-tier
    45  ```
    46  
    47  You can then use your preferred code editor to browse and read the configurations.
    48  To try out an example, run Terraform's init and apply commands while in the example's directory:
    49  
    50  ```
    51  $ terraform init
    52  ...
    53  $ terraform apply
    54  ...
    55  ```
    56  
    57  Terraform will interactively ask for variable input and potentially
    58  provider configuration, and will start executing.
    59  
    60  When you're done with the example, run `terraform destroy` to clean up.