GitHunt
MA

matifali/terraform-provider-nayatel

Quick start repository for creating a Terraform provider using terraform-plugin-framework

Terraform Provider for Nayatel Cloud

This Terraform provider enables you to manage resources on Nayatel Cloud, including instances, networks, routers, floating IPs, and security groups.

Community project notice: This provider is community-maintained by Muhammad Atif Ali and is not an official Nayatel product.

It is not affiliated with, endorsed by, or supported by Nayatel.

Requirements

  • Terraform >= 1.0
  • Go >= 1.24 (for building from source)
  • A Nayatel Cloud account

Installation

From Source

git clone https://github.com/matifali/terraform-provider-nayatel.git
cd terraform-provider-nayatel
go build -o terraform-provider-nayatel

Local Development Override

Create a ~/.terraformrc file with the following content to use your locally built provider:

provider_installation {
  dev_overrides {
    "matifali/nayatel" = "/path/to/terraform-provider-nayatel"
  }
  direct {}
}

Authentication

The provider supports three authentication methods:

export NAYATEL_USERNAME="your-username"
export NAYATEL_PASSWORD="your-password"

Option 2: Token-based Authentication

export NAYATEL_USERNAME="your-username"
export NAYATEL_TOKEN="your-jwt-token"

Option 3: Provider Block Configuration

provider "nayatel" {
  username = "your-username"
  password = "your-password"
  # OR
  # token = "your-jwt-token"
}

Usage

terraform {
  required_providers {
    nayatel = {
      source = "matifali/nayatel"
    }
  }
}

provider "nayatel" {}

# Create a network
resource "nayatel_network" "main" {
  bandwidth_limit = 1
}

# Create a router
resource "nayatel_router" "main" {
  name       = "main-router"
  network_id = nayatel_network.main.id
  subnet_id  = nayatel_network.main.subnet_id
}

# Create an instance
resource "nayatel_instance" "web" {
  name            = "webserver"
  image_id        = "your-image-id"
  cpu             = 2
  ram             = 2
  disk            = 20
  network_id      = nayatel_network.main.id
  ssh_fingerprint = "your-ssh-public-key"

  depends_on = [nayatel_router.main]
}

# Attach a floating IP
resource "nayatel_floating_ip_attachment" "web" {
  instance_id = nayatel_instance.web.id
}

# Attach a security group
resource "nayatel_security_group_attachment" "web" {
  instance_id         = nayatel_instance.web.id
  security_group_name = "default"
}

Resources

nayatel_instance

Creates and manages a compute instance.

Attribute Type Required Description
name string Yes Name of the instance
image_id string Yes ID of the OS image
cpu number Yes Number of vCPUs
ram number Yes RAM in GB
disk number Yes Disk size in GB
network_id string Yes ID of the network
ssh_fingerprint string Yes SSH public key
id string Computed Instance ID
private_ip string Computed Private IP address
status string Computed Instance status

nayatel_network

Creates and manages a network with an associated subnet.

Attribute Type Required Description
bandwidth_limit number No Bandwidth limit in Gbps (default: 1)
id string Computed Network ID
name string Computed Network name
subnet_id string Computed Associated subnet ID

nayatel_router

Creates and manages a router with external gateway.

Attribute Type Required Description
name string Yes Name of the router
network_id string Yes ID of the network to connect
subnet_id string Yes ID of the subnet to connect
id string Computed Router ID

nayatel_floating_ip_attachment

Attaches a floating IP to an instance.

Attribute Type Required Description
instance_id string Yes ID of the instance
id string Computed Floating IP ID
ip_address string Computed Public IP address

nayatel_security_group_attachment

Attaches a security group to an instance.

Attribute Type Required Description
instance_id string Yes ID of the instance
security_group_name string Yes Name of the security group
id string Computed Attachment ID

Data Sources

nayatel_images

Lists available OS images.

data "nayatel_images" "available" {}

output "images" {
  value = data.nayatel_images.available.images
}

nayatel_flavors

Lists available instance flavors (CPU/RAM/Disk combinations).

data "nayatel_flavors" "available" {}

nayatel_ssh_keys

Lists available SSH keys.

data "nayatel_ssh_keys" "available" {}

nayatel_networks

Lists available networks.

data "nayatel_networks" "available" {}

nayatel_security_groups

Lists available security groups.

data "nayatel_security_groups" "available" {}

Building The Provider

go build -o terraform-provider-nayatel

Developing the Provider

To compile the provider:

go install

To generate or update documentation:

make generate

To run the acceptance tests:

make testacc

Note: Acceptance tests create real resources and may incur costs.

License

This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.

Copyright (c) 2026 Muhammad Atif Ali.