Ignoring manual changes
In the previous recipe, we learned how to prevent resources from being deleted when using Terraform by using the prevent_destroy
property.
In some situations, which need to be measured, we need to modify the resource properties manually, i.e., without having to modify the Terraform configuration. And as we know, if we modify a resource outside the Terraform configuration, the next time we apply Terraform, the changes we made manually will be overwritten by the Terraform configuration. When Terraform is applied, it performs a refresh step that reads the current state of the infrastructure and compares it to the desired state described in the configuration files. If Terraform detects any changes between the two, it will attempt to modify the infrastructure to match the desired state.
This is the purpose of IaC, to have the code be the source of truth for the state of the infrastructure.
In this recipe, we will learn how to update the Terraform configuration...