GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation allows locking a Terraform state file within a specific GitLab project using the GitLab API. It is useful for managing Terraform state in infrastructure as code workflows, ensuring that the state file is locked during updates to prevent concurrent modifications. 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 GitLab project to prevent concurrent modifications during infrastructure deployment.
  2. Automating Terraform state management in GitLab CI/CD pipelines by locking the state file before running terraform apply.

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 for the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the API request, default is GET.
Path Parameters Parameters for the API request path, including project ID and Terraform state name.

Output

JSON

  • lock_id - Identifier of the lock created on the Terraform state.
  • locked_at - Timestamp when the lock was created.
  • locked_by - Information about the user who created the lock.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and Terraform state name are correctly specified to avoid 404 errors.
  • Authentication errors may occur if the API key is missing or invalid; verify credentials.
  • Permission errors can happen if the API key does not have sufficient rights to lock the Terraform state.

Links

Discussion