Skip to content

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

Availability and Testing

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

#235108 (closed)

Edited by Tiger Watson

Merge request reports