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 172.16.0.0/16 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.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube