Announcing the Avisi Cloud Terraform Provider!

Posted January 22, 2024 by Thomas Kooi and Viradj Jainandunsing ‐ 2 min read

Use Terraform for managing Avisi Cloud Kubernetes and other resources

Announcing the release of the Avisi Cloud Terraform Provider

Introducing the Avisi Cloud Terraform Provider. With our new Terraform Provider it is now easier than ever to provision Kubernetes clusters across any cloud through code. Combined with our various Terraform Modules to get you started quickly, you can set-up robust production ready Kubernetes clusters within seconds on any cloud.

Unifying Multi-Cloud Complexity

Gone are the days of dealing with the intricacies and nuances of various cloud providers. The Avisi Cloud Terraform Provider offers a unified and consistent interface, regardless of your chosen cloud platform. Whether you’re building clusters on AWS, Azure, or any other supported provider, you’ll experience a seamless and standardized management process.

Getting started with our Terraform Provider

Here’s a quick guide to get you started:

Begin by creating a personal access token within the Avisi Cloud Console. Navigate to API Access for straightforward token generation. Detailed instructions are available in our documentation.

Once you have your API token, configure it within your Terraform Provider as shown below.

terraform {
  required_providers {
    acloud = {
      version = "0.1.5"
      source  = "avisi-cloud/acloud"
    }
  }
}

variable "acloud_token" {
}
variable "acloud_api" {
}

provider "acloud" {
  token      = var.acloud_token
  acloud_api = var.acloud_api
}

Example Usage

Terraform’s power lies in its ability to rapidly provision infrastructure. Let’s dive into an example showcasing the creation of a Kubernetes cluster within the Avisi Cloud ecosystem:

variable "organisation_slug" {
}

variable "environment_slug" {
}

resource "acloud_environment" "env" {
  name         = "demo"
  type         = "development"
  organisation = var.organisation_slug
  description  = "Showcasing Terraform"
}

module "cluster" {
  source             = "avisi-cloud/cluster/acloud"
  version            = "0.0.2"
  organisation_slug  = var.organisation_slug
  environment_slug   = acloud_environment.env.slug
  cluster_name       = "demo"
  cloud_account_name = "demo"

  # Kubernetes Version Update Channel
  # See https://docs.avisi.cloud/docs/how-to/kubernetes/update-a-cluster/
  update_channel_name = "v1.28"

  # AWS specific settings
  region         = "eu-west-1"
  cloud_provider = "aws"

  enable_multi_availability_zones = true
  default_node_size               = "t3.medium"
  default_node_count              = 1

  node_pools = {
    database = {}
    apps    = {}
    ingress = {}
  }
}

With this example, you can swiftly create a new Kubernetes cluster within an environment named demo. The cluster’s version will be with the latest supported release for Avisi Cloud Kubernetes, automatically detected from the v1.28 update channel. Upon terraform apply, it will automatically update the Kubernetes cluster to the next patch or release.

Keep in mind that configuring a cloud account within the Console is a prerequisite for this process. Our articles on cloud accounts provide the guidance you need to get started.