Immutable Infrastructure is a server deployment paradigm where services are replaced instead of being updated in place. The soon-to-be replaced service doesn’t get changed, the new service with the appropriate changes will be created, and the old service will simply be destroyed (with the help from Infrastructure as Code (IaC)# tools). It eases the work of versioning (updating services), rollback, recovery, and scaling.
Immutable Infrastructure
-
Terraform Lifecycle
Within the #resource block, we could define a lifecycle block to have fine control over how to manage the resource which could be useful in Immutable Infrastructure# implementation. There are three options available:
create_before_destroy
,prevent_destroy
andignore_changes
. -
Server Templating
Server Templating tools are often used to set up an Immutable Infrastructure# using Virtual Machine (VM)# and Container# images. To modify the underlying infrastructure in demands of changing requirements, it can simply update the existing images without affecting other already running environment. #Infrastructure as Code (IaC) sometimes involves Server Templating.