Terraform State Management

preview_player
Показать описание
Terraform state file stores the state of infrastructure which we create from terraform files.

It means whenever we create any resource using terraform then terraform also stores the information of the resource in terraform state file.

It stores the information about resources that are currently live-in cloud environment.

Desired state: In terraform configuration file we write the terraform code for creating resource. This configuration is the desired state of the resources.

Current state: It is actual state of a resource that is currently deployed. Now if someone manually makes some changes to the resources which is created using terraform then that will be the current state of that infrastructure.

Terraform ensures that the deployed infrastructure is always based on desired state.

If there is difference between these two then terraform plan pushes current state to go back to the desired state.

Terraform creates the state file in local machine and that is not recommended.
We can keep out state file to a remote location and all teammates can collaborate and work on same state file.

terraform {
backend "azurerm" {
resource_group_name = "Resource Group Name"
storage_account_name = “Storage account name"
container_name = “Container Name"
}
}
Рекомендации по теме
Комментарии
Автор

Great explanation, thank you very much

saisantosh-cwvz
Автор

Very Good one and crystal clear explanation bro..!!!

praveenkumaravishakula
Автор

Detailed explanation on the tf state file, keep going on

gopimeidshetty
Автор

bhai yar module or interview ke question pe video banawo

sopankumbhare
Автор

Hi I am facing some issues while creating multiple resources. every time old resources destroying. could you please guide me in that issue.requesting you to take the session even Paid also fine for me

muralikrishnachintada