DevOps Classroom notes 04/Jan/2025

Terraform

Variables

  • Variables are the inputs that can be passed
  • official docs
  • basic syntax for creating a variable
variable "<name>" {
    type = <datatypes of terrarform>
    default = ""
    description = "purpose of variable"
}
  • To use the variable use syntax var.<name>

Using variables in activity 1

  • Refer Here for the changes
  • Variable values can be passed during apply
terraform apply -var "<name>=<value>"
terraform apply -var vpc_cidr=10.0.0.0/16
  • Variables values can be stored in a file with extension .tfvars and passed during apply. Refer Here for docs
terraform apply -var-file='default.tfvars'

Outputs

  • Terraform template outputs show the output after every apply Refer Here for official docs
  • Sample output

Adding a sample output to activity 1

  • Refer Here for changes.
  • outputs.tf file contains outputs

How to create multiple resources in terraform

Terraform functions

Activity 2: Create a Network in Azure

  • Overview
  • Manual steps: (Watch classroom recording)
  • Terraform azure providers
    • azurerm (Hashicorp) this is most widely used
    • azapi (Microsoft) few customers use this as well
  • Refer Here for changes done to create the network as mentioned in the above image
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%