Seed initial version for non-versioned terraform states
What does this MR do?
- Seeds an initial version for all Terraform states created prior to versioning being enabled by default (#207347 (closed)), which will allow removal of the legacy non-versioned storage mechanism.
- Adds logic that will migrate these Terraform states to use the versioning behaviour, which will run the next time each individual state is pushed to.
Migration (1335 records to update on GitLab.com)
INSERT INTO terraform_state_versions (terraform_state_id, created_at, updated_at, version, file_store, file)
SELECT id, NOW(), NOW(), 0, file_store, file
FROM terraform_states
WHERE versioning_enabled = FALSE
ON CONFLICT (terraform_state_id, version) DO NOTHING
https://explain.depesz.com/s/duZx
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Tiger Watson