terraform resources, modules and other configuration items
Go to file
2022-05-16 17:07:50 +03:00
kubernetes-cluster add kubernetes cluster sample 2022-05-16 17:07:50 +03:00
terraform/triton new example scripts 2022-03-01 12:59:39 +02:00
triton update examples 2022-03-01 12:58:33 +02:00
.gitignore gitignore, remove swap file 2022-02-28 17:05:58 +02:00
README updated readme 2022-03-01 13:00:48 +02:00
README.md renamed readme 2022-03-01 13:01:18 +02:00

Terraform resources

Terraform templates and other resources/examples for use with spearhead.coud or other triton providers.

In the terraform directory you will find some templates to help get you started. Remove the tpl extension and modify to your liking.

Examples

Provision a vm

$ git clone https://github.com/spearheadsys/terraform-spearhead.cloud.git

edit the main.tf file

terraform {
  required_providers {
    triton = {
      source = "joyent/triton"
      version = "0.8.2"
    }
  }
}

provider "triton" {
    account = "username"
    key_id  = "key:id"
    url = "https://eu-ro-1.api.spearhead.cloud"
    key_material = "/path/to/id_rsa"
    insecure_skip_tls_verify = false
}

resource "triton_machine" "internal_resource_name" {
  // customize these if you need to create multiple instances
  // comment our the count if you need just one
  // remove the variable count.index from the name if so
  count   = var.instance_count
  name    = "linux-${count.index + 1}"
  package = "standard-2cpu-4ram-100disk"
  // choose on image (lx, hvm or smartos)
  image   = "b70d5484-5168-4ecb-8127-0a0c59c1d906"

/*
// Use these (provisioner file and remote-exec if you would like to 
// further customize or run specific commands once the instance 
// is provisioned

  provisioner "file" {
    source = "scripts/setup.sh"
    destination = "/var/tmp/setup.sh"
  }

  provisioner "remote-exec" {
    inline = [
      "bash /var/tmp/setup.sh",
    ]
  }
*/

  connection {
    type = "ssh"
    host = self.primaryip
    user = "ubuntu"
  }

/*
// use this to configure the Container Namer Service within triton and access
// your system(s) via a service name/tag defined in the variables.tf file
// you would then be able to access your system(s) via dns. For more details see
// [this](http://docs.spearhead.cloud/dns/)

  cns {
        services = ["${var.service_name}"]
  }
*/
}

Provision using terraform(hvm bhyve ubuntu 20.04.03)

$ terraform init
$ terraform plan
$ terraform apply

Creating images with Packer

coming soon...