DevOps Classroomnotes 31/Mar/2023

Terraform Contd…

Terraform Modules

  • Terraform modules are reusable terraform templates
  • There are lot of community modules on terraform registry
  • Module demo Refer Here for module usage with aws
  • To create ec2 Refer Here

Terraform provisioners

  • Provisioners are for performing activities in local or remote instance after resource creation

Terraform interview questions

  • What is terraform
  • What is infrastructure as Code
  • Can Ansible replace Terraform
  • What is resource, argument and attribute
  • What is terraform lifecycle:
    • here we have three stages
      • create
      • modify
      • delete
    • actions:
      • op
      • no-op
  • What is terraform registry: this is collection of modules
  • How to use two providers
    • use alias
provider "aws" {
region = "us-west-2"
alias = red
}

provider "aws" {
region = "us-west-2"
alias = green
}

resource "aws_vpc" "red_vpc" {
provider = aws.red
}

resource "aws_vpc" "green_vpc" {
provider = aws.green
}

  • How to use terraform in ci/cd pipeline
    • on jenkins node install terraform
    • sh terraform apply -auto-approve
    • azure devops:
      • bash terraform apply -auto-approve
      • Terraform market place
  • What is the purpose of backend
  • What is the purpose of workspace
  • Write one terraform template to do resource creation
  • How to do zero down time deployments in terraform

    • Create tags and apply terraform only of specific tags
    • Use count with conditions
  • How to delete the resource which is managed by terraform
terraform state rm <resource-path>
  • How to delete and recreate the resource during next apply
terraform taint <resource-path>

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

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