Skip to content

This is a sample Terraform script for setting up resources in Azure

Notifications You must be signed in to change notification settings

Botvinnik94/terraform-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Terraform template example

This repository provides an example of using Terraform to provision infrastructure in Azure. The example is meant to serve as a template for people who are new to Terraform or looking for a simple example to get started with.

Prerequisites

To use this example, you need to have the following installed:

Usage

  1. Clone the repository
git clone https://github.com/Botvinnik94/terraform-example.git
  1. Authenticate to Azure CLI
az login
  1. Navigate to the repository directory
cd terraform-example/terraform
  1. Check and modify the configuration files if necessary:

    • main.tf contains the infrastructure definition.
    • variables.tf contains the variables used in the infrastructure definition.
    • vars/<env>.tfvars contains the actual variable value for each environment.
  2. Ensure that you have created the following resources in Azure (you can change the naming by modifying the backend names in main.tf):

    • Resource Group with the name botvinnik-tf-rg
    • Storage Account within that Resource group with the name botvinniktfstac
    • Container within that Storage Account with the name botvinnik-tf-cont
  3. Initialize Terraform

terraform init
  1. Plan the Terraform execution with the variable file for the target environment
terraform plan -var-file=vars/<env>.tfvars
  1. Apply the Terraform execution
terraform apply -var-file=vars/<env>.tfvars

Clean up

To destroy the resources created by Terraform, run:

terraform destroy

About

This is a sample Terraform script for setting up resources in Azure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages