filmov
tv
Terraform State Management
Показать описание
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"
}
}
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"
}
}
Комментарии