VK Cloud logo
Updated at April 19, 2024   12:00 PM

Quick start

Preparatory steps

  1. Install Terraform from the official VK Cloud mirror.

  2. Open your VK CLoud personal account.

  3. Enable two-factor authentication and API access, if not enabled yet.

  4. Click on your login at the top of the page, select Project settings from the drop-down menu.

  5. Go to the Terraform tab. Download the main Terraform configuration and the Terraform mirror configuration files by clicking the corresponding buttons.

    Files named vkcs_provider.tf and terraform.rc will be downloaded.

  6. Perform the following actions with the files:

    1. Paste %APPDATA% into the address bar of Windows Explorer and copy the terraform.rc file to the directory that opens.

    2. Copy the vkcs_provider.tf file into the working directory from which you are going to work with the platform.

      Typically a separate working directory is created for each VK Cloud project.

Terraform initialization

In the directory from which you are going to work with the project, run the command:

terraform init

This will create supplementary files needed for Terraform to work.

Creating resources via Terraform

  1. Create a configuration of resources in the working directory — for example, a configuration for creating a virtual machine.

  2. Run the command:

    terraform apply

    In the terminal window, type yes to confirm the operation.

  3. Wait until the operation is complete.

The created resources will be available in your personal account.

Update Terraform

If the provider version in the vkcs_provider.tf file is lower than the one needed to create the resource, an error will occur when checking the configuration. To avoid this, update your provider:

  1. Open the vkcs_provider.tf file and edit the version as you need, for example: version = "~> 0.6.0".
  2. Run the command in the terminal:
terraform init --upgrade