DevOps Classroom Series – 02/Mar/2021

Creating multiple resources with terraform

  • Refer Here for the usage of count meta-argument
  • Use the count for creating subnets, Refer Here for the changes done Preview
  • Terraform has functions, and now lets use one function to calculate cidr ranges dynamically
  • Now lets recreate the terraform infra and use the cidrsubnet function Refer Here for the changes Preview Preview
  • Now lets look at terraform expressions Refer Here
  • Now lets generalize the az selection Refer Here
  • Now lets create the infrastructure in mumbai region (ap-south-1) with cidr range of Preview Preview
  • Subnet names in the template are actually fixed according to architecture, user should not be change those values
  • To acheive this lets use local variables, which are used with in template and cannot be set from outside. For the documentation of local variables Refer Here
  • Refer Here for the changes
  • Summary:
    • We have used count for looping
    • Calculated the values of az’s using terraform expressions
    • for the values which should not be parameterized, we had used locals.
    • Doing this has given us flexibility to use template in any region.

Leave a Reply

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

About learningthoughtsadmin