/yc-remote-dev

Terraform config for remote dev environment at Yandex Cloud

Primary LanguageHCL

Terraform config for remote dev environment at Yandex Cloud

Before you start


Prepare to setup

  1. Create secrets.env

  2. Copy secrets.env.example contents to secrets.env

  3. Fill secrets.env with credentials

  4. Update variables in locals inside workstation/main.tf if needed. Use commands below to check your changes.

     $ terraform fmt
     $ terraform validate
    

Setup

  1. Build docker container

     $ docker-compose build
    
  2. Run docker container

     $ make dc_run
    
  3. Create SSH keys for root user at workstation which will be created

     $ make generate_ssh
    
  4. Create workstation in Yandex cloud

     $ cd workstation/
     $ terraform init
     $ terraform apply
    
  5. Confirm changes shown in plan


Your ssh key will be stored in terraform.tfstate and terraform.tfstate.backup files as plain text


Usage outside container

  1. To get workstation info use:

     $ make dc_vm_info
    
  2. To get workstation IP address use:

     $ make dc_vm_ip
    
  3. To start workstation use:

     $ make dc_vm_start
    
  4. To stop workstation use:

     $ make dc_vm_stop
    
  5. To connect by ssh use:

     $ eval $(make dc_ssh_vm)
    

Usage inside container

  1. If you don't run container with make dc_run setup yandex CLI with

     $ make yc_init
    
  2. To get workstation info use:

     $ make vm_info
    
  3. To get workstation IP address use:

     $ make vm_ip
    
  4. To start workstation use:

     $ make vm_start
    
  5. To stop workstation use:

     $ make vm_stop
    
  6. To connect by ssh use:

     $ eval $(make ssh_vm)
    

Additional info