Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 02:50:22 +0300
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /doc/administration/terraform_state.md
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'doc/administration/terraform_state.md')
-rw-r--r--doc/administration/terraform_state.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/administration/terraform_state.md b/doc/administration/terraform_state.md
index 0f3fdf4bb93..0c01279b04c 100644
--- a/doc/administration/terraform_state.md
+++ b/doc/administration/terraform_state.md
@@ -97,6 +97,39 @@ The following settings are:
| `remote_directory` | The bucket name where Terraform state files are stored | |
| `connection` | Various connection options described below | |
+### Migrate to object storage
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/247042) in GitLab 13.9.
+
+To migrate Terraform state files to object storage, follow the instructions below.
+
+- For Omnibus package installations:
+
+ ```shell
+ gitlab-rake gitlab:terraform_states:migrate
+ ```
+
+- For source installations:
+
+ ```shell
+ sudo -u git -H bundle exec rake gitlab:terraform_states:migrate RAILS_ENV=production
+ ```
+
+For GitLab 13.8 and earlier versions, you can use a workaround for the Rake task:
+
+1. Open the GitLab [Rails console](operations/rails_console.md).
+1. Run the following commands:
+
+ ```ruby
+ Terraform::StateUploader.alias_method(:upload, :model)
+
+ Terraform::StateVersion.where(file_store: ::ObjectStorage::Store::LOCAL). find_each(batch_size: 10) do |terraform_state_version|
+ puts "Migrating: #{terraform_state_version.inspect}"
+
+ terraform_state_version.file.migrate!(::ObjectStorage::Store::REMOTE)
+ end
+ ```
+
### S3-compatible connection settings
See [the available connection settings for different providers](object_storage.md#connection-settings).