HashiCorp Cloud Platform
Integrate with GitLab
HCP Vault Secrets allows users to automatically synchronize application secrets to GitLab groups or projects. This guide walks you through the configuration process.
Prerequisites:
- Permissions to create an GitLab variables
- An Admin role in an HCP Project
- An HCP Vault Secrets application and secret(s)
Configuration
Navigate to the GitLab portal and generate a group or project token. For creating project variables, the role must be Maintainer or Owner. For creating group variables, the role must be Owner. If you are working with custom roles, ensure that the role has the permissions
admin_cicd_variables
. For more information, see the GitLab documentation. Save this token for the next step.Note
Personal API tokens are not allowed for the GitLab integration. Only group or project tokens are supported.Navigate to the HCP Vault Secrets app you would like to integrate with GitLab. From the sidebar, select Integrations then click on the GitLab card to set up the integration.
Provide the token that you generated in the previous step. Click on Save and continue to proceed.
Provide a unique name for your integration.
Next, you'll be prompted to configure the sync details. You can either sync your secrets to a GitLab group or project.
- Navigate to the GitLab group page you would like to integrate with HCP Vault Secrets.
- Click the copy to clipboard icon next to the group ID.
- Navigate back to HCP Vault Secrets and paste the group ID.
- Configure the optional Environment scope, Protected, and Expand variable fields.
Once all required fields are populated, click Save and sync secrets to complete the configuration process. It will immediately sync all of your existing app secrets to the specified GitLab group or project.