GitLab API

GitlabTool

Actions905

Overview

This node operation locks a Terraform state file in a GitLab project using the GitLab API. It is useful for managing Terraform state locking to prevent concurrent modifications, ensuring infrastructure as code consistency. For example, it can be used in CI/CD pipelines to lock the Terraform state before applying changes.

Use Case Examples

  1. Locking a Terraform state file in a specific GitLab project to prevent concurrent Terraform runs.
  2. Automating Terraform state locking as part of an infrastructure deployment workflow.

Properties

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

Output

JSON

  • lock_id - The ID of the created lock on the Terraform state.
  • state_name - The name of the Terraform state that was locked.
  • project_id - The ID of the GitLab project where the Terraform state is located.
  • locked_by - Information about the user or process that created the lock.
  • created_at - Timestamp when the lock was created.

Dependencies

  • GitLab API authentication token

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 token is missing or invalid; verify credentials.
  • API rate limits or network issues can cause request failures; check connectivity and API usage limits.

Links

Discussion