website/intro: remove outdated examples section (#26932)

This commit is contained in:
Kristin Laemmert 2020-11-16 14:05:17 -05:00 committed by GitHub
parent 7cfba365dc
commit 79fd81775e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 209 deletions

View File

@ -1,28 +0,0 @@
---
layout: "intro"
page_title: "Two-Tier AWS Architecture"
sidebar_current: "examples-aws"
description: |-
This provides a template for running a simple two-tier architecture on Amazon Web services. The premise is that you have stateless app servers running behind an ELB serving traffic.
---
# Two-Tier AWS Architecture
[**Example Source Code**](https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/two-tier)
This provides a template for running a simple two-tier architecture on Amazon
Web Services. The premise is that you have stateless app servers running behind
an ELB serving traffic.
To simplify the example, it intentionally ignores deploying and
getting your application onto the servers. However, you could do so either via
[provisioners](/docs/provisioners/index.html) and a configuration
management tool, or by pre-baking configured AMIs with
[Packer](https://www.packer.io).
After you run `terraform apply` on this configuration, it will
automatically output the DNS address of the ELB. After your instance
registers, this should respond with the default Nginx web page.
As with all the examples, just copy and paste the example and run
`terraform apply` to see it work.

View File

@ -1,57 +0,0 @@
---
layout: "intro"
page_title: "Consul Example"
sidebar_current: "examples-consul"
description: |-
Consul is a tool for service discovery, configuration and orchestration. The Key/Value store it provides is often used to store application configuration and information about the infrastructure necessary to process requests.
---
# Consul Example
[**Example Source Code**](https://github.com/terraform-providers/terraform-provider-consul/tree/master/examples/kv)
[Consul](https://www.consul.io) is a tool for service discovery, configuration
and orchestration. The Key/Value store it provides is often used to store
application configuration and information about the infrastructure necessary
to process requests.
Terraform provides a [Consul provider](/docs/providers/consul/index.html) which
can be used to interface with Consul from inside a Terraform configuration.
For our example, we use the [Consul demo cluster](https://demo.consul.io/)
to both read configuration and store information about a newly created EC2 instance.
The size of the EC2 instance will be determined by the `tf_test/size` key in Consul,
and will default to `m1.small` if that key does not exist. Once the instance is created
the `tf_test/id` and `tf_test/public_dns` keys will be set with the computed
values for the instance.
Before we run the example, use the [Web UI](https://demo.consul.io/ui/dc1/kv/)
to set the `tf_test/size` key to `t1.micro`. Once that is done,
copy the configuration into a configuration file (`consul.tf` works fine).
Either provide the AWS credentials as a default value in the configuration
or invoke `apply` with the appropriate variables set.
Once the `apply` has completed, we can see the keys in Consul by
visiting the [Web UI](https://demo.consul.io/ui/dc1/kv/). We can see
that the `tf_test/id` and `tf_test/public_dns` values have been
set.
You can now [tear down the infrastructure](https://learn.hashicorp.com/tutorials/terraform/aws-destroy?in=terraform/aws-get-started&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
Because we set the `delete` property of two of the Consul keys, Terraform
will clean up those keys on destroy. We can verify this by using
the Web UI.
This example has shown that Consul can be used with Terraform both to read
existing values and to store generated results.
Inputs like AMI name, security groups, Puppet roles, bootstrap scripts,
etc can all be loaded from Consul. This allows the specifics of an
infrastructure to be decoupled from its overall architecture. This enables
details to be changed without updating the Terraform configuration.
Outputs from Terraform can also be easily stored in Consul. One powerful
feature this enables is using Consul for inventory management. If an
application relies on ELB for routing, Terraform can update the application's
configuration directly by setting the ELB address into Consul. Any resource
attribute can be stored in Consul, allowing an operator to capture anything
useful.

View File

@ -1,20 +0,0 @@
---
layout: "intro"
page_title: "Count"
sidebar_current: "examples-count"
description: |-
The count parameter on resources can simplify configurations and let you scale resources by simply incrementing a number.
---
# Count Example
[**Example Source Code**](https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/count)
The `count` parameter on resources can simplify configurations
and let you scale resources by simply incrementing a number.
Additionally, variables can be used to expand a list of resources
for use elsewhere.
As with all the examples, just copy and paste the example and run
`terraform apply` to see it work.

View File

@ -1,21 +0,0 @@
---
layout: "intro"
page_title: "Cross Provider"
sidebar_current: "examples-cross-provider"
description: |-
An example of the cross-provider capabilities of Terraform.
---
# Cross Provider Example
[**Example Source Code**](https://github.com/hashicorp/terraform/tree/master/examples/cross-provider)
This is a simple example of the cross-provider capabilities of
Terraform.
This creates a Heroku application and points a DNS
CNAME record at the result via DNSimple. A `host` query to the outputted
hostname should reveal the correct DNS configuration.
As with all the examples, just copy and paste the example and run
`terraform apply` to see it work.

View File

@ -1,65 +0,0 @@
---
layout: "intro"
page_title: "Example Configurations"
sidebar_current: "examples"
description: |-
These examples are designed to help you understand some of the ways Terraform can be used.
---
# Example Configurations
The examples in this section illustrate some
of the ways Terraform can be used.
All examples are ready to run as-is. Terraform will
ask for input of things such as variables and API keys. If you want to
continue using the example, you should save those parameters in a
"terraform.tfvars" file or in a `provider` config block.
~> **Warning!** The examples use real providers that launch _real_ resources.
That means they can cost money to experiment with. To avoid unexpected charges,
be sure to understand the price of resources before launching them, and verify
any unneeded resources are cleaned up afterwards.
Experimenting in this way can help you learn how the Terraform lifecycle
works, as well as how to repeatedly create and destroy infrastructure.
If you're completely new to Terraform, we recommend reading the
[Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) collection on HashiCorp Learn before diving into
the examples. However, due to the intuitive configuration Terraform
uses it isn't required.
## Examples
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)
To use these examples, Terraform must first be installed on your machine.
You can install Terraform from the [downloads page](/downloads.html).
Once installed, you can download, view, and run the examples.
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:
```
git clone https://github.com/terraform-providers/terraform-provider-aws.git
cd terraform-provider-aws/examples/two-tier
```
You can then use your preferred code editor to browse and read the configurations.
Note that in this example, the connection block defaults to using a local SSH agent for authentication with the instance.
Therefore ensure that the appropriate private key has been added to the agent before running the below steps.
Alternatively, as can be seen in some of the other examples, the `private_key` argument can also be used.
To try out an example, run Terraform's init and apply commands while in the example's directory:
```
$ terraform init
...
$ terraform apply
...
```
Terraform will interactively ask for variable input and potentially
provider configuration, and will start executing.
When you're done with the example, run `terraform destroy` to clean up.

View File

@ -53,24 +53,6 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<a href="/intro/examples/index.html">Example Configurations</a>
<ul class="nav">
<li>
<a href="/intro/examples/aws.html">Two-Tier AWS Architecture</a>
</li>
<li>
<a href="/intro/examples/cross-provider.html">Cross Provider</a>
</li>
<li>
<a href="/intro/examples/count.html">Count Parameter</a>
</li>
<li>
<a href="/intro/examples/consul.html">Consul</a>
</li>
</ul>
</li>
</ul> </ul>
<%= partial("layouts/otherdocs", :locals => { :skip => "Introduction to Terraform" }) %> <%= partial("layouts/otherdocs", :locals => { :skip => "Introduction to Terraform" }) %>