Quick start
-
Install Terraform binaries from the official VK Cloud mirror.
-
Create a provider mirror file and paste it in the directory.
WindowsOther OS-
Create the
terraform.rc
file. -
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 }
-
Paste
%APPDATA%
into the address bar of Windows Explorer and copy the fileterraform.rc
to the directory that opens.
-
-
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 isvkcs
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. Specifyuser_name
andpassword
for your personal account, also fill your account password topassword
parameter.
1provider "vkcs" { 2 username="USER_NAME" 3 password = "YOUR_PASSWORD" 4 project_id = "111111111111111111111111111" 5 region = "RegionOne" 6}
- The first terraform block describes which providers are required (
In the directory with the file main.tf
run the command:
terraform init
Additional files necessary for working with Terraform will be created.
Enable two-factor authentication and enable API access.
-
Run the command:
terraform apply
The
apply
command applies your Terraform configuration (plan) to VK Cloud resources specified in the filemain.tf
. -
Confirm the creation by typing
yes
in the terminal window.