VK Cloud logo

Quick start

Prepare for work

  1. Install Terraform binaries from the official VK Cloud mirror.

  2. Create a provider mirror file and paste it in the directory.

    1. Create the terraform.rc file.

    2. Add the code to it.

      1provider_installation {
      2     network_mirror {
      3         url = "https://terraform-mirror.mcs.mail.ru"
      4         include = ["registry.terraform.io/*/*"]
      5     }
      6     direct {
      7         exclude = ["registry.terraform.io/*/*"]
      8     }
      9 }
    3. Paste %APPDATA% into the address bar of Windows Explorer and copy the file terraform.rc to the directory that opens.

  3. Create a main.tf file and describe the necessary terraform providers in it. File consists from the blocks:

    • The first terraform block describes which providers are required (required_providers). Inside is vkcs provider source and its versions. If you are going to use additional providers, add them in this block.
    1terraform {
    2    required_providers {
    3        vkcs = {
    4            source = "vk-cs/vkcs"
    5        }
    6    }
    7}
    • The provider "vkcs" block describes the settings for the provider from VK Cloud. Specify user_name and password for your personal account, also fill your account password to password parameter.
    1provider "vkcs" {
    2    username="USER_NAME"
    3    password = "YOUR_PASSWORD"
    4    project_id = "111111111111111111111111111"
    5    region = "RegionOne"
    6}

Setting working directory

In the directory with the file main.tf run the command:

terraform init

Additional files necessary for working with Terraform will be created.

2FA and API access

Enable two-factor authentication and enable API access.

Apply

  1. Run the command:

    terraform apply
    

    The apply command applies your Terraform configuration (plan) to VK Cloud resources specified in the file main.tf.

  2. Confirm the creation by typing yes in the terminal window.