-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc] Update Terraform use cases #36013
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,37 +3,58 @@ layout: "intro" | |||||||||
page_title: "Use Cases" | ||||||||||
sidebar_current: "use-cases" | ||||||||||
description: |- | ||||||||||
Learn how Terraform enables multi-cloud deployments, application management, policy compliance, and self-service infrastructure. | ||||||||||
Learn how Terraform enables multi-cloud deployments, application management, policy compliance, and self-service infrastructure. | ||||||||||
--- | ||||||||||
|
||||||||||
# Use Cases | ||||||||||
|
||||||||||
[HashiCorp Terraform](/terraform/intro) is an infrastructure as code tool that lets you define infrastructure resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to safely and efficiently provision and manage your infrastructure throughout its lifecycle. | ||||||||||
[HashiCorp Terraform](/terraform/intro) is an infrastructure as code (IaC) tool that lets you define infrastructure resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to safely and efficiently provision and manage your infrastructure throughout its lifecycle. | ||||||||||
|
||||||||||
This page describes popular Terraform use cases and provides related resources that you can use to create Terraform configurations and workflows. | ||||||||||
|
||||||||||
## Multi-Cloud Deployment | ||||||||||
## Codify your infrastructure | ||||||||||
|
||||||||||
By capturing and building your infrastructure as code, you make your deployments faster, repeatable, and easier to collaborate on. Terraform codifies cloud APIs into declarative configuration files, using HashiCorp Configuration Language (HCL). You define the desired state of your infrastructure in HCL and Terraform will deploy and configure the resources to match your configuration. | ||||||||||
|
||||||||||
In addition to configuring your networks, servers, and databases, you can also use Terraform to manage other resources like containers, machine images, web services, and observability services. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add an intro sentence to this list please? |
||||||||||
- Get started with Terraform on [AWS](/terraform/tutorials/aws-get-started), [Azure](/terraform/tutorials/azure-get-started), [Google Cloud](/terraform/tutorials/gcp-get-started), or [Docker](/terraform/tutorials/docker-get-started). | ||||||||||
- Read HashiCorp's Well-Architected Framework to learn how to [codify your infrastructure with Terraform](/operational-excellence/operational-excellence-manage-your-infrastructure-components-with-terraform). | ||||||||||
|
||||||||||
## Multi-cloud deployment | ||||||||||
|
||||||||||
Provisioning infrastructure across multiple clouds increases fault-tolerance, allowing for more graceful recovery from cloud provider outages. However, multi-cloud deployments add complexity because each provider has its own interfaces, tools, and workflows. Terraform lets you use the same workflow to manage multiple providers and handle cross-cloud dependencies. This simplifies management and orchestration for large-scale, multi-cloud infrastructures. | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [For this and the rest of the article] could you please add intro sentences for the lists? |
||||||||||
- Learn how to [standardize artifacts across multiple cloud providers] with Terraform and Packer. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you are missing a link? |
||||||||||
- Try our [Deploy Federated Multi-Cloud Kubernetes Clusters](/terraform/tutorials/networking/multicloud-kubernetes) tutorial to provision Kubernetes clusters in both Azure and AWS environments, configure Consul federation with mesh gateways across the two clusters, and deploy microservices across the two clusters to verify federation. | ||||||||||
- Browse the [Terraform Registry](https://registry.terraform.io/browse/providers) to find thousands of publicly available providers. | ||||||||||
|
||||||||||
## Multi-environment deployments | ||||||||||
|
||||||||||
You may have staging or QA environments that you use to test new applications before releasing them in production. As the production environment grows larger and more complex, it can be increasingly difficult to maintain an up-to-date environment for each stage of the development process. Terraform Stacks let you split your Terraform configuration into components and then deploy and manage those components across multiple environments. You can manage the lifecycle of each deployment separately, making it easy to validate changes throughout your deployments. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got a little carried away with my rewrite, but I think this still feels clear? Feel free to disregard anything you don't like!
Suggested change
|
||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
- Read the [Deploy a Stack with HCP Terraform](/terraform/tutorials/cloud/stacks-deploy) tutorial to get hands-on experience. You will create a Terraform Stack that deploys an AWS Lambda function across a development, test, and production environment. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intro sentence please! Also would it be too much to add the stacks docs too? There is a page about stacks use cases that feels very on-brand with the rest of the article: https://developer.hashicorp.com/terraform/language/stacks/use-cases |
||||||||||
|
||||||||||
## Application Infrastructure Deployment, Scaling, and Monitoring Tools | ||||||||||
## Application infrastructure deployment, scaling, and monitoring tools | ||||||||||
|
||||||||||
You can use Terraform to efficiently deploy, release, scale, and monitor infrastructure for multi-tier applications. N-tier application architecture lets you scale application components independently and provides a separation of concerns. An application could consist of a pool of web servers that use a database tier, with additional tiers for API servers, caching servers, and routing meshes. Terraform allows you to manage the resources in each tier together, and automatically handles dependencies between tiers. For example, Terraform will deploy a database tier before provisioning the web servers that depend on it. | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
- Try our [Automate Monitoring with the Terraform Datadog Provider](/terraform/tutorials/applications/datadog-provider) tutorial to deploy a demo Nginx application to a Kubernetes cluster with Helm and install the Datadog agent across the cluster. The Datadog agent reports the cluster health back to your Datadog dashboard. | ||||||||||
- Try our [Use Application Load Balancers for Blue-Green and Canary Deployments](/terraform/tutorials/aws/blue-green-canary-tests-deployments) tutorial. You will provision the blue and green environments, add feature toggles to your Terraform configuration to define a list of potential deployment strategies, conduct a canary test, and incrementally promote your green environment. | ||||||||||
- Read the HashiCorp Well-Architected Framework recommendations for [managing infrastructure and service monitoring](/well-architected-framework/reliability/reliability-deploy-application-monitoring-components) | ||||||||||
|
||||||||||
|
||||||||||
## Self-Service Clusters | ||||||||||
## Self-service infrastructure | ||||||||||
|
||||||||||
At a large organization, your centralized operations team may get many repetitive infrastructure requests. You can use Terraform to build a "self-serve" infrastructure model that lets product teams manage their own infrastructure independently. You can create and use Terraform modules that codify the standards for deploying and managing services in your organization, allowing teams to efficiently deploy services in compliance with your organization’s practices. HCP Terraform can also integrate with ticketing systems like ServiceNow to automatically generate new infrastructure requests. | ||||||||||
At a large organization, your centralized operations team may get many repetitive infrastructure requests. You can use Terraform to build a "self-serve" infrastructure model that lets product teams manage their own infrastructure independently. You can create and use Terraform modules that codify the standards for deploying and managing services in your organization, allowing teams to efficiently deploy services in compliance with your organization's practices. HCP Terraform can also integrate with ticketing systems like ServiceNow to automatically generate new infrastructure requests. | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
|
@@ -42,26 +63,16 @@ Try the [Build and Use a Local Module](/terraform/tutorials/modules/module-creat | |||||||||
- Follow these [ServiceNow Service Catalog Integration Setup Instructions](/terraform/cloud-docs/integrations/service-now) to connect ServiceNow to HCP Terraform. | ||||||||||
|
||||||||||
|
||||||||||
## Policy Compliance and Management | ||||||||||
## Policy compliance and management | ||||||||||
|
||||||||||
Terraform can help you enforce policies on the types of resources teams can provision and use. Ticket-based review processes are a bottleneck that can slow down development. Instead, you can use Sentinel, a policy-as-code framework, to automatically enforce compliance and governance policies before Terraform makes infrastructure changes. Sentinel policies are available in Terraform Enterprise and [HCP Terraform](https://www.hashicorp.com/products/terraform/pricing). | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
- Try the [Control Costs with Policies](/terraform/tutorials/cloud-get-started/cost-estimation) tutorial to estimate the cost of infrastructure changes and define policy to limit it. | ||||||||||
|
||||||||||
- The [Sentinel documentation](/terraform/cloud-docs/policy-enforcement) provides more in-depth information and a list of example policies that you can adapt for your use cases. | ||||||||||
|
||||||||||
|
||||||||||
## PaaS Application Setup | ||||||||||
Platform as a Service (PaaS) vendors like Heroku allow you to create web applications and attach add-ons, such as databases or email providers. Heroku can elastically scale the number of dynos or workers, but most non-trivial applications need many add-ons and external services. You can use Terraform to codify the setup required for a Heroku application, configure a DNSimple to set a CNAME, and set up Cloudflare as a Content Delivery Network (CDN) for the app. Terraform can quickly and consistently do all of this without a web interface. | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
Try the [Deploy, Manage, and Scale an Application on Heroku](/terraform/tutorials/applications/heroku-provider) tutorial to manage an application’s lifecycle with Terraform. | ||||||||||
|
||||||||||
|
||||||||||
## Software Defined Networking | ||||||||||
## Software defined networking | ||||||||||
|
||||||||||
Terraform can interact with Software Defined Networks (SDNs) to automatically configure the network according to the needs of the applications running in it. This lets you move from a ticket-based workflow to an automated one, reducing deployment times. | ||||||||||
|
||||||||||
|
@@ -72,21 +83,13 @@ For example, when a service registers with [HashiCorp Consul](https://www.consul | |||||||||
- Try the [Network Infrastructure Automation with Consul-Terraform-Sync Intro](/consul/tutorials/network-infrastructure-automation/consul-terraform-sync-intro) tutorial to install Consul-Terraform-Sync on a node. You will then configure it to communicate with a Consul datacenter, react to service changes, and execute an example task. | ||||||||||
- Try the [Consul-Terraform-Sync and Terraform Enterprise/Cloud Integration](/consul/tutorials/network-infrastructure-automation/consul-terraform-sync-terraform-enterprise) tutorial to configure Consul-Terraform-Sync to interact with Terraform Enterprise and HCP Terraform. | ||||||||||
|
||||||||||
|
||||||||||
## Kubernetes | ||||||||||
|
||||||||||
Kubernetes is an open-source workload scheduler for containerized applications. Terraform lets you both deploy a Kubernetes cluster and manage its resources (e.g., pods, deployments, services, etc.). You can also use the [Kubernetes Operator for Terraform](https://github.com/hashicorp/terraform-k8s) to manage cloud and on-prem infrastructure through a Kubernetes Custom Resource Definition (CRD) and HCP Terraform. | ||||||||||
|
||||||||||
### Resources | ||||||||||
|
||||||||||
- Learn how to provision a Kubernetes cluster in [AWS](/terraform/tutorials/kubernetes/eks), [Google Cloud Platform](/terraform/tutorials/kubernetes/gke), and [Azure](/terraform/tutorials/kubernetes/aks). | ||||||||||
- Try the [Manage Kubernetes Resources via Terraform](/terraform/tutorials/kubernetes/kubernetes-provider) tutorial. You will use Terraform to schedule and expose a NGINX deployment on a Kubernetes cluster. | ||||||||||
- Try the [Deploy Infrastructure with the HCP Terraform Operator for Kubernetes](/terraform/tutorials/kubernetes/kubernetes-operator) tutorial. You will configure and deploy the Operator to a Kubernetes cluster and use it to create an HCP Terraform workspace and provision a message queue for an example application. | ||||||||||
|
||||||||||
|
||||||||||
## Parallel Environments | ||||||||||
|
||||||||||
You may have staging or QA environments that you use to test new applications before releasing them in production. As the production environment grows larger and more complex, it can be increasingly difficult to maintain an up-to-date environment for each stage of the development process. Terraform lets you rapidly spin up and decommission infrastructure for development, test, QA, and production. Using Terraform to create disposable environments as needed is more cost-efficient than maintaining each one indefinitely. | ||||||||||
|
||||||||||
|
||||||||||
## Software Demos | ||||||||||
You can use Terraform to create, provision, and bootstrap a demo on various cloud providers. This lets end users easily try the software on their own infrastructure and even enables them to adjust parameters like cluster size to more rigorously test tools at any scale. | ||||||||||
- Learn how to [deploy applications with the Helm provider](/terraform/tutorials/kubernetes/helm-provider). | ||||||||||
- Try the [Deploy Infrastructure with the HCP Terraform Operator for Kubernetes](/terraform/tutorials/kubernetes/kubernetes-operator-v2) tutorial. You will configure and deploy the Operator to a Kubernetes cluster and use it to create an HCP Terraform workspace and provision a message queue for an example application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.