DevOps Classroom notes 20/Sep/2024

loops in Terraform

Count meta argument

Activity 2.2: use count to create multiple subnets in a loop

Activity 1.2: Lets change the vpc template and

  • Lets ask the user the vpc cidr range and subnet cidr ranges
  • Lets ask the user for the Name of vpc and subnets
  • Also implement count to create 4 subnets
  • inputs to vpc
    • cidr block
    • tags
  • inputs to subnet
    • cidr block
    • availability zone
    • tags
  • Refer Here for the changes done

Activity 2.3 use complex variables in azure

  • Refer Here for changes done to include complex variables.

Passing variables during apply

  • we have already looked at option terraform apply -var <var-name>='value'
  • Terraform also gives us an option to pass multiple variables at one shot in variables file
  • This variables file will have extension of .tfvars and to pass it during apply terraform apply -var-file='dev.tfvars'

Activity 1.3 use variables file for aws template

  • we have created a file called dev.tfvars which represents values for dev environment
  • Command used to create infra
terraform apply -var-file='dev.tfvars'

Terraform functions

  • Refer Here for the official docs of terraform functions

Activity 1.4: Use function to get how many subnets to be created

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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
Exit mobile version
%%footer%%