DevOps Classroomnotes 29/Jul/2023

Terraform contd

  • Order of Creation: Order of creation can be acheived in two ways
    • explicit dependency using depends_on Refer Here
    • implicit dependency: Terraform figures out by looking at your configuration/template
      • When the output (attribute) of one resource is used as input (argument) to other
      • Refer Here for the changes
  • To use one resource in other resource argument <resource_type>.<name>
depends_on = [ azurerm_resource_group.myresg ]

Best Practice to write terraform template (Based on what we have covered so far)

  • Terraform reads all the .tf files in the folder and then combines as one file and executes the terraform => While writing terraform templates there is no need write everything in one file
    • From now one lets have one tf for provdier and then one tf file for logical group of resources.
    • All the variables will be in one file and all the outputs will be in the file
  • Use terraform fmt to align the terraform template into common canonical format Refer Here for the changes done

Manual Steps for next activity

  • Azure
  • AWS

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner