Introduction
Terraform Enterprise includes a feature to create snapshots of system configuration from the administration dashboard. You can use these snapshots to restore a Terraform Enterprise instance to a new host machine, preserving system-level audit history, LDAP configurations, and other settings.
Prerequisites
Before you begin, ensure the following requirements are met:
- The settings file,
/etc/replicated.conf, must not exist on the destination host machine. - For airgapped installations, you must follow additional requirements detailed in the documentation. This guide does not cover the airgapped procedure.
Procedure
Follow these steps to restore Terraform Enterprise from a snapshot.
-
For Mounted Disk Installations Only: If you are using a Mounted Disk installation, you must transfer the existing data to the new host.
- Log in to the source Terraform Enterprise administration console at
https://<TFE_HOSTNAME>:8800. - Navigate to the Settings page and select Mounted Disk Configuration.
- Record the value for Path on Host.
- Transfer the data from that directory on the source host to the same path on the destination host. This step is not required for External Services installations.
- Log in to the source Terraform Enterprise administration console at
- Choose one of the following options based on your snapshot storage method.
Option 1: Restore from a Local Snapshot
Local snapshots are stored on the host's local filesystem.
- Transfer the entire snapshot directory from the source Terraform Enterprise host to the destination host.
- On the destination host, create a restoration script using the example script for local directory restoration. Replace
absolute_path_to_directory_of_snapshotswith the absolute path to the snapshot directory you transferred.
Option 2: Restore from an S3 Snapshot
S3 snapshots are stored in an AWS S3 bucket and do not need to be moved between hosts.
- On the destination host, create a restoration script using the example script for S3 restoration.
- Replace the placeholder values (
your_bucket_to_store_snapshots,region_of_the_bucket,aws_access_key_id, andaws_secret_access_key) with your S3 bucket details and AWS credentials.
Option 3: Restore from an SFTP Snapshot
SFTP snapshots are stored on a remote SFTP server.
- On the destination host, create a restoration script using the example script for SFTP restoration.
- Replace the placeholder values (
path_to_your_ssh_key,sftp_server_hostname_or_ip, anduser_to_sftp_on_the_remote_server) with your SFTP server details. - Execute the Restoration Script: On the destination host, execute the script you created. The script installs Terraform Enterprise, restores the latest backup from the specified snapshot location, and automatically configures the application settings to match the snapshot.