GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves a specific version of a Terraform state from a GitLab project using the GitLab API. It is useful for DevOps and infrastructure teams who manage Terraform states within GitLab and need to access historical state versions for auditing, rollback, or analysis purposes. For example, a user can fetch the details of a particular Terraform state version by specifying the project ID, state name, and version serial number.

Use Case Examples

  1. Retrieve Terraform state version 5 for project ID '123' and state name 'prod-state' to inspect the infrastructure configuration at that point in time.
  2. Fetch a specific Terraform state version to compare changes between versions or to restore a previous state.

Properties

Name Meaning
Skip Authentication Option to skip authentication when making the API request.
Authentication Type of authentication used for the API request, defaulting to GitLab API key.
baseUrl Base URL of the GitLab instance to which the API request is sent.
Method HTTP method used for the API request, default is GET.
Path Parameters Parameters required in the API path to specify the project ID, Terraform state name, and version serial number.

Output

JSON

  • id - The unique identifier of the Terraform state version.
  • serial - The version number of the Terraform state.
  • created_at - Timestamp when the Terraform state version was created.
  • updated_at - Timestamp when the Terraform state version was last updated.
  • state - The actual Terraform state data or metadata returned by the API.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID, state name, and serial number are correctly specified and URL-encoded if necessary.
  • Verify that the GitLab API key credential is valid and has sufficient permissions to access the Terraform state data.
  • Check the base URL to ensure it points to the correct GitLab instance, especially if using a self-hosted GitLab server.
  • Common error messages include 404 Not Found if the specified project or state version does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion