and generating their terraform config
start with a MWE and no definitions
vi providers.tf terraform { required_providers { yandex = { source = "yandex-cloud/yandex" } } required_version = ">= 1.0.0" } vi main.tf import { # yc vpc address list id = "..." # test/ test-host1 public ip to = yandex_vpc_address.static } import { id = "..." # test/ test-host1 disk to = yandex_compute_disk.boot-disk } import { id = "..." # test/ test-host1 instance to = yandex_compute_instance.server }
prepare your env
yc config profile list yc config profile activate test export YC_TOKEN=`yc iam create-token` export YC_CLOUD_ID=`yc config get cloud-id` echo $YC_TOKEN echo $YC_CLOUD_ID
now ready to generate the definitions
terraform init terraform plan -generate-config-out=generated_resources.tf cat generated_resources.tf >> main.tf rm -f generated_resources.tf rm -rf .terraform* terraform init terraform plan terraform apply
FW https://developer.hashicorp.com/terraform/language/import/generating-configuration