DevOps Classroom notes 14/Apr/2026

Adding multiple resources

  • Terraform count meta argument helps in creating multiple number of resources Refer Here
  • syntax
resource '...' '...' {
    count = 5
    ....
}
  • When you are accessing resources we need to use index
  • Example
resource 'aws_subnet' 'subnets {
    count = 3
}

# aws_subnets[0] => 1 subnet
# aws_subnets[2] => 3 subnet
  • Refer Here for the changes to add multiple subnets
  • Aws has a concept of public and private subnets

Lets create private and public subnets

  • To make subnet public:
    • It should be associated with a route table which has route to internet gateway
  • To make subnet private:
    • It should be associated with a route table which does not have a route to internet gateway
  • Exercise:
    • Makes changes in the current terrform template which should support
      • private subnets
      • public subnets
    • You need to create internet gateway
    • you need to create two route tables
    • For public route table create a route to internet gateway
    • Associate public subets with public route table
    • Associate private subnets with private route table.
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%%