GitLab API

GitlabTool

Actions1000

Overview

This node operation allows locking a Terraform state in a specific GitLab project by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/terraform/state/{name}/lock`. It is useful for managing Terraform state locking to prevent concurrent modifications, which is critical in infrastructure as code workflows to ensure state consistency.

Use Case Examples

  1. Locking a Terraform state file named 'production' in a GitLab project with ID '12345' to prevent concurrent changes during deployment.
  2. Automating Terraform state locking as part of a CI/CD pipeline to ensure safe infrastructure updates.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the API request.
Authentication Type of authentication used for the API request, defaulting to GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters to specify the project ID and Terraform state name in the API path.

Output

JSON

  • lock_status - Status of the Terraform state lock operation returned by the GitLab API.
  • lock_id - Identifier of the lock created on the Terraform state.
  • message - Additional message or information returned by the API about the lock operation.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and Terraform state name are correctly specified; incorrect values will cause API errors.
  • Authentication errors may occur if the GitLab API key is missing or invalid; verify credentials.
  • Network or base URL misconfiguration can lead to connection failures; confirm the base URL is correct and accessible.

Links

Discussion