DevOps Classroomnotes 05/Jun/2022

Terraform backends

  • When two engineers execute the terraform configuration with a perspective to create infrastructure for an application, it creates two different infra.
  • What if these two engineers want to create the same environment, in this case the state should not be on the local system, it should be present on common location.
  • This approach is called as backend. The default backend is local folder
  • Refer Here for the terraform backends

  • Lets create a common infra for multiple users using Azure RM backend
    Refer Here for the changes done
  • For simulating multiple users i will be creating a linux instance, installing terraform and creating infra
  • Now execute initialization
  • Now apply from system 2 and execute apply from system 1 as well, on system you should get an error message of lock acquired by some one else
  • After successful apply from system 2 now execute apply from system 1
  • AWS S3 Backend: We can use s3 backend, but for locking we need to use dynamo db. Refer Here
  • Refer Here for the s3 backend changeset
  • Initialize the backend and do the rest as done for azurerm backend

Workspaces

  • Using Terraform configuration to create multiple environmetns from the same configuration
  • Refer Here for the changeset containing workspace demo features
  • Lets initialize
  • Lets check for the workspaces available. create the dev on the system 2

  • Lets create dev from system 2 and qa from system 1 parallely
  • Dev from system 2

Lifecycle

Packer

  • Packer is a free and opensource tool to create images i.e we can create azure vm images, aws amis
  • Refer Here
  • Refer Here for installing packer
  • Refer Here for the example to create ami with packer in aws
  • Refer Here for the changes to create azure vm image
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
Customized Social Media Icons from Acurax Digital Marketing Agency

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%%