Giter Site home page Giter Site logo

masoud-maghsoudi / terraform-linux-vps-arvancloud Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 12 KB

Create a fleet of Linux machines bound with SSH keys in ArvanCloud Service provider using Terraform

License: MIT License

HCL 100.00%
arvancloud terraform terraform-modules

terraform-linux-vps-arvancloud's Introduction

terraform-linux-vps-arvancloud

About

This project helps to create a fleet of Linux VPS bound with specific SSH key in ArvanCloud Service provider using Terraform. 4 modules have been developed in this project for different Linux distributions specified below:

  • CentOS
    • 7
  • Debian
    • 10 (Buster)
    • 11 (Bullseye)
    • 12 (Bookworm)
  • Rocky
    • 8.5
    • 9
  • Ubuntu
    • 18.04 (Bionic)
    • 20.04 (Focal)
    • 22.04 (Jammy)

you can have a combination of linux machines from different distribiutions at the same time. even you can make customized OS template in your Arvanclpud panel and add it as module to the code and call it in main.tf file.

Example

before running code you are required to get API key from your Arvancloud panel and set it in terraform.tfvars:

ApiKey = "someapikey0123456789"

based on Arvancloud access regions at the time of writing this document, you can assign variable region with one of options below:

Region alias Description
ir-thr-c1 Simin Datacenter located in Iran, Tehran
ir-thr-c2 Forough Datacenter located in Iran, Tehran
ir-tbz-dc1 Shahriar Datacenter located in Iran, Tabriz
ir-thr-w1 Forough Datacenter located in Iran, Tehran

for example, if you intend to provision a infrastructure in Tabriz datacenter set this in teraform.tafvars:

region = "ir-tbz-dc1"

if you are not familiar with SSH keypairs, read this instruction to generate an SSH keypair. in order to access your machines via SSH you need to set variable public-key in terraform.tfvars with the content of your generated public key file usually found in ~/.ssh/id_rsa.pub. please consider keeping your private key securely.

public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmUs3m50UiEyBuswzg8gAUtI0ewRTHiqT6k1bsLCX3YWDrC7k+uLvBnxHoyKdCMedAg95Wf+rIc4Ph86m+LNyKrYN1Pji4/toWhNH1dQN5edadCnZXe9TrFwNIRfCSVsp1PDedAdvLut5V0mGLOA9l/iILjaCM+hw9ljV9XFnB5Na80R2T1C7oFXn2/bxp1+QCC5eUnVh3WkG9C9HNSh27eLP/mAW7OIhyt6PV5yOd8AtjIFoCAO0cCyMiH4btB488jWGezx47jRnfYBIHjkL9CnvkccAx3YSAiTcikIUJUDk3O+ptrkKckJ75Ea2yzMzvcAYhVEGrkw5gNzpX8x5R"

variable server_count is equivalent to the number of instances you wish to deploy, which is 0 by default. consider setting this parameter in terraform.tfvars before apply. for example if you want to create 3 instance from Ubunut and 2 instances of Rocky Linux:

server_count_rocky  = 2
server-count-ubuntu = 3

each module has a variable named image-name which could be set in module call in main.tf file. their default value is set to the latest version of each distribiution at the time of writing this document.

module "server-ubuntu" {
  source       = "./modules/server-ubuntu"
  region       = var.region
  ApiKey       = var.ApiKey
  key_name     = arvan_iaas_sshkey.ssh-key-user-terraform.name
  server-count = var.server-count-ubuntu
  image-name   = "Ubunut/18.04"
}

License

MIT

Author Information

Author Masoud Maghsoudi
Email [email protected]
Github https://github.com/masoud-maghsoudi

terraform-linux-vps-arvancloud's People

Contributors

masoud-maghsoudi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.