DevOps Classroomnotes 26/May/2022

Terraform State

  • Terraform maintains the information of resources created in the state file.
  • This file contains a custom JSON format that records a mapping from the Terraform resources in your configuration files to a representation of those resources in the real world (Provider).
  • When we execute terraform apply, terraform first fetches the information from provider about the resources in state file and compares that to the state file, if there any changes required to match what you want (expressed) in your configuration file, terraform executes them
  • terraform state matches with existing resources
    Preview
  • Now Delete the resources manually in AWS/Azure and execute terraform apply will try to create the resources again
    Preview
  • Ideally terraform state should be stored in common location for multiple users to execute the terraform apply leading to same infra, we will be learning this very soon as part of terraform backends.
    Preview

Activity 2: Try to create a network with six subnets in Azure and a storage account

  • In Azure to create any resources we need to first create a resource group
  • Watch the classroom video for steps
  • Now we need to configure provider first
  • Refer Here for the documentation
  • Lets configure the authentication with Azure CLI, Lets install Azure CLI Refer Here
  • Once azure cli is installed. Relaunch powershell az login and login into azure account.
  • Configure provider Refer Here
    Preview
  • Lets configure resource group after provider configuration Refer Here
  • Refer Here for the vnet configuration
  • Refer Here for subnet creation
  • Refer Here for the changes
    Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner