Deleting a GitLab instance
If the instance has deletion protection enabled, disable it first, and then delete the instance.
- In the management console, select the folder where you want to delete a GitLab instance.
- Go to Managed Service for GitLab.
- Click
for the instance and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To delete a GitLab instance, run this command:
yc managed-gitlab instance delete <instance_name_or_ID>
You can request the instance ID or name with the list of instances in the folder.
Result:
done (3m14s)
For more information about this command, see the CLI reference.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To delete a GitLab instance created using Terraform:
-
Open the Terraform configuration file and delete the section describing the
yandex_gitlab_instanceresource:Example of a GitLab instance description in the Terraform configuration:
resource "yandex_gitlab_instance" "my_gitlab_instance" { name = "gl-instance" resource_preset_id = "s2.micro" disk_size = 100 admin_login = "gitlab-user" admin_email = "gitlab-user@example.com" domain = "gitlab-terraform.gitlab.yandexcloud.net" subnet_id = "e9bsdv4iunrv********" approval_rules_id = "BASIC" backup_retain_period_days = 7 deletion_protection = true } -
Apply the changes:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
You can check the updates using the management console
yc managed-gitlab instance list
Use the Delete REST API method for the Instance resource or the InstanceService/Delete gRPC API call.
If you have deleted a GitLab instance but want to recover it, contact support