Skip to content

arvancloud/terraform-provider-arvan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform logo

Terraform Provider for ArvanCloud

How to use

  1. Get an API Key from ArvanCloud Dashboard
  2. Create a main.tf file and put the following content into (boilerplate):
terraform {
  required_providers {
    arvan = {
      source  = "arvancloud/arvan"
      version = "0.6.4" # put the version here
    }
  }
}

variable "ApiKey" {
  type = string
  default = "<Your API Key>"
  sensitive = true
}

provider "arvan" {
  api_key = var.ApiKey
}

Create an Abrak

Put the following content into a main.tf file:

terraform {
  required_providers {
    arvan = {
      source  = "arvancloud/arvan"
      version = "0.6.4"
    }
  }
}

variable "ApiKey" {
  type = string
  default = "<Your API Key>"
  sensitive = true
}

provider "arvan" {
  api_key = var.ApiKey
}


variable "abrak-name" {
  type = string
  default = "terraform-abrak-example"
}

variable "region" {
  type = string
  default = "ir-thr-c2" # Forogh Datacenter
}

resource "arvan_iaas_abrak" "abrak-1" {
  region = var.region
  flavor = "g1-1-1-0"
  name   = var.abrak-name
  image {
    type = "distributions"
    name = "debian/11"
  }
  disk_size = 25
}

data "arvan_iaas_abrak" "get_abrak_id" {
  depends_on = [
    arvan_iaas_abrak.abrak-1
  ]

  region = var.region
  name   = var.abrak-name
}

output "details-abrak-1" {
  value = data.arvan_iaas_abrak.get_abrak_id
}

then apply the following command to use your APIKEY as variable: Ensure to prepend the following phrase: "Apikey YOUR API KEY"

terraform init
TF_VAR_ApiKey="<YOUR API KEY>" terraform apply

More Examples

Other examples are available here

How to build

# clone it
$ git clone github.com/arvancloud/terraform-provider-arvan

# compile and install it
$ make install

Note: use arvancloud.com/terraform/arvan as source in your main.tf.