Skip to content

Commit f95dde9

Browse files
committed
Adds docs for Getting started
1 parent c45a47c commit f95dde9

File tree

6 files changed

+94
-1
lines changed

6 files changed

+94
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Terraform Labs brings you tutorials that help you get hands-on experience using
1717

1818
# Terraform Workshop/Labs
1919

20-
- [Getting Started: Why, What & How about Terraform?]() - Not Started
20+
- [Getting Started: Why, What & How about Terraform?](getting-started/README.md) - In Progress
2121

2222
- [Beginners Track](https://github.com/collabnix/terraform/blob/master/beginners/README.md) - In-Progress
2323

getting-started/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Getting Started - Terraform
2+
3+
This section is all about how to get started with Terraform - what is it & why it is needed.
4+
5+
Following topics are covered in this section:
6+
7+
- [The problem of provisioning everything manually](the-problem.md)
8+
- [The concept of Infrastructure as a Code (IaC)](iac.md)
9+
- [Where terraform comes in?](terraform.md)
10+
- [Use cases of Terraform](use-cases.md)

getting-started/iac.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# The Concept of Infrastructure as a Code (IaC)
2+
3+
Infrastructure as a Code (IaC), as the name suggests, is a way of managing your entire infrastructure in the form of code. It helps us to solve several problems such as:
4+
5+
1. **Reproducible Environments:** By using code to generate infrastructure, the same environment can be created over and over. Over time an environment can drift away from its desired state and difficult to diagnose issues can creep into your release pipeline. With IaC no environment gets special treatment and fresh new environments are easily created and destroyed.
6+
7+
2. **Idempotence & Convergence:** In IaC, only the actions needed to bring the environment to the desired state are executed. If the environment is already in the desired state, no actions are taken.
8+
9+
3. **Easing Collaboration:** Having the code in a version control system like Git allows teams to collaborate on infrastructure. Team members can get specific versions of the code and create their own environments for testing or other scenarios.
10+
11+
4. **Self-service Infrastructure:** A pain point that often existed for developers before moving to cloud infrastructure was the delays required to have operations teams create the infrastructure they needed to build new features and tools. With the elasticity of the cloud allowing resources to be created on-demand, developers can provision the infrastructure they need when they need it. IaC further improves the situation by allowing developers to use infrastructure modules to create identical environments at any point in the application development lifecycle. The infrastructure modules could be created by operations and shared with developers freeing developers from having to learn another skill.
12+
13+
All combined these benefits make IaC a staple in DevOps practices.
14+
15+
***
16+
17+
[< Previous](the-problem.md) [Next >](terraform.md)

getting-started/terraform.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Enter Terraform
2+
3+
**Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently.** Terraform can manage existing and popular service providers as well as custom in-house solutions.
4+
5+
Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an _execution plan_ describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.
6+
7+
The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.
8+
9+
Following are the key features of Terraform:
10+
11+
1. **Infrastructure as a Code:** As discussed earlier, Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.
12+
13+
2. **Execution Plans:** Terraform has a "planning" step where it generates an _execution plan_. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure.
14+
15+
3. **Resource Graph:** Terraform builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.
16+
17+
4. **Change Automation:** Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors.
18+
19+
***
20+
21+
[< Previous](iac.md) [Next >](use-cases.md)

getting-started/the-problem.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The problem of provisioning everything manually
2+
3+
Whenever we have the need to setup any infrastructure we always tend to go towards the manual approach by clicking and going through the steps in the UI provided by the major public cloud provider (AWS, Azure, GCP), cloud provider (Linode, DigitalOcean etc.), DNS provider (CloudFlare, Route53, DNSimple etc.) and many such services.
4+
5+
One way to approach this problem is to use scripts. But with that comes another set of challenges such as:
6+
7+
- They're idiosyncratic - if I wrote a script, the other person might not be able to understand the steps being performed.
8+
- They're not idempotent - if I ran the script multiple times, it might not provide me the same result.
9+
- Compatibility issues - if I developed the script on a Linux machine, the other person who is using Windows might not be able to use the script and vice versa.
10+
- The scripts are only for one task. If you want to deploy something else, you need to develop them again.
11+
12+
So, how to automate the setup process without having to deal with the hassles of developing a script? That's where the concept of Infrastructure as a Code (IaC) comes in.
13+
14+
***
15+
16+
[Next >](iac.md)

getting-started/use-cases.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Use Cases of Terraform
2+
3+
We can specify some use-cases which can help you with the applications of Terraform as an IaC solution:
4+
5+
## Heroku App Setup
6+
7+
Terraform can be used to codify the setup required for a Heroku application, ensuring that all the required add-ons are available, but it can go even further: configuring DNSimple to set a CNAME, or setting up Cloudflare as a CDN for the app. Best of all, Terraform can do all of this in under 30 seconds without using a web interface.
8+
9+
## Multi-tier Applications
10+
11+
A very common pattern is the N-tier architecture. The most common 2-tier architecture is a pool of web servers that use a database tier. Additional tiers get added for API servers, caching servers, routing meshes, etc. This pattern is used because the tiers can be scaled independently and provide a separation of concerns.
12+
13+
Terraform is an ideal tool for building and managing these infrastructures. Each tier can be described as a collection of resources, and the dependencies between each tier are handled automatically; Terraform will ensure the database tier is available before the web servers are started and that the load balancers are aware of the web nodes. Each tier can then be scaled easily using Terraform by modifying a single `count` configuration value. Because the creation and provisioning of a resource is codified and automated, elastically scaling with load becomes trivial.
14+
15+
## Disposable Environments
16+
17+
It is common practice to have both a production and staging or QA environment. These environments are smaller clones of their production counterpart, but are used to test new applications before releasing in production. As the production environment grows larger and more complex, it becomes increasingly onerous to maintain an up-to-date staging environment.
18+
19+
Using Terraform, the production environment can be codified and then shared with staging, QA or dev. These configurations can be used to rapidly spin up new environments to test in, and then be easily disposed of. Terraform can help tame the difficulty of maintaining parallel environments, and makes it practical to elastically create and destroy them.
20+
21+
## Multi-cloud Deployments
22+
23+
It's often attractive to spread infrastructure across multiple clouds to increase fault-tolerance. By using only a single region or cloud provider, fault tolerance is limited by the availability of that provider. Having a multi-cloud deployment allows for more graceful recovery of the loss of a region or entire provider.
24+
25+
Realizing multi-cloud deployments can be very challenging as many existing tools for infrastructure management are cloud-specific. Terraform is cloud-agnostic and allows a single configuration to be used to manage multiple providers, and to even handle cross-cloud dependencies. This simplifies management and orchestration, helping operators build large-scale multi-cloud infrastructures.
26+
27+
***
28+
29+
[< Previous](terraform.md)

0 commit comments

Comments
 (0)