Skip to main content

Documentation Index

Fetch the complete documentation index at: https://gcore.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Terraform is a declarative command-line utility used to manage infrastructure as code. The desired state of resources is defined in a configuration file, and Terraform sends the necessary API requests to create or update them.

Provider versions

The Gcore Terraform provider is published under the G-Core/gcore namespace on the Terraform Registry. Two major versions are currently available:
v0v2
StatusStableAlpha
Authenticationpermanent_api_tokenapi_key
Terraform CLI>= 0.13.0>= 1.11
Code maintenanceHand-writtenAuto-generated from OpenAPI spec
API syncManual updatesStays in sync with the API automatically
Recommended forExisting projectsNew projects
Both versions share the same registry namespace (G-Core/gcore), so pin the version explicitly to control which one Terraform uses. v0 is the production-ready provider for existing projects. v2 is a ground-up rewrite of the provider, auto-generated from the Gcore OpenAPI specification. It stays in sync with the API automatically, which means new resources and attributes become available faster than in v0. v2 is the recommended choice for new projects.

Install Terraform

Follow these steps to install Terraform and configure the Gcore provider.
  1. Download a Terraform package suitable for the OS from the official Terraform website.
  2. Create a new folder and name it the same as the downloaded package.
  3. Unzip the Terraform archive in the new folder.
  4. Add the directory of the unzipped Terraform archive to the PATH environment variable.
  5. Create a configuration file in the Terraform folder and name it main.tf.
  6. Generate a permanent API token if one doesn’t exist yet.
Add the following provider configuration to main.tf:
terraform {
  required_version = ">=0.13.0"
  required_providers {
    gcore = {
      source  = "G-Core/gcore"
      version = "0.34.0"
    }
  }
}

provider "gcore" {
  permanent_api_token = "251$d33611b35f26d8"
}
Replace 251$d33611b35f26d8 with the permanent API token. Check the Terraform Registry for the latest v0 release and update the version accordingly.
NotePin the provider to an exact version or use a pessimistic constraint (~> 0.34) to stay on v0. v0 and v2 use different resource schemas and authentication methods and are not interchangeable.
Then run the following command from the Terraform folder to initialize the provider:
terraform init
The output confirms that Terraform has been successfully downloaded and installed:
Terminal output showing Terraform successfully initialized with the Gcore provider

Configure provider v2

Provider v2 uses a different authentication method (api_key) and a redesigned provider schema that is incompatible with v0 configurations. Almost all v2 resources support terraform import, making it possible to bring existing Gcore infrastructure under Terraform management without recreating it.
Infov2 is in active development. Pin the version to a specific alpha release to control when updates are applied. Bug reports and feedback are welcome on the GitHub issues page.
Configuration details, available resources, and usage examples are in the v2 documentation on Terraform Registry. The v2 source code is on the v2 branch of the GitHub repository. Migration from v0 to v2 requires manual configuration updates—no automated migration path is available. Migration guidelines are published as part of the v2 provider documentation on Terraform Registry.

Manage Gcore resources

The Gcore Terraform v0 provider supports Cloud resources—Virtual Machines, Bare Metal servers, Kubernetes clusters, Load Balancers, and networks—and CDN resources, rules, and SSL certificates.