displague / deprecated-terraform-provider-linode

[OLD] Terraform provider plugin for Linode Cloud resources.. See
https://github.com/terraform-providers/terraform-provider-linode
Mozilla Public License 2.0
15 stars 5 forks source link

[WIP] linode_instance resource matches API #19

Closed displague closed 6 years ago

displague commented 6 years ago

Refactors instances, configs, and disks to align more with the Linode API.

Covers several recommendations from #16 and additional feedback.

Adds support for Stackscripts: Closes #9

Refactor Todo (each requiring passing tests)

Example Resource

resource "linode_stackscript" "helloworld" {
  label = "hello world"
  script = <<EOF
#!/bin/bash
# <UDF name="gh_username" Label="GitHub Username" example="..." />
echo Hello, $GH_USERNAME
EOF
  images = ["linode/ubuntu18.04"]
  description = "the hello world of stackscripts"
  rev_note = "initial version"
}

resource "linode_instance" "simple" {
  label = "simple"
  type = "g6-nanode-1"
  region = "us-east"
  image = "linode/ubuntu18.04"
  swap_size = "256"
}

resource "linode_instance" "foo" {
  label = "advanced"
  type = "g6-nanode-1"
  region = "us-east"

  disk {
    label = "root"
    filesystem = "ext4"
    image = "linode/ubuntu18.04"
    size = "20000"
    root_pass = "b4d_p4s$"
    stackscript_id = "${linode_stacsckript.helloworld.id}"
    stackscript_data = {
      gh_username = "displague"
    }
  }

  disk {
    label = "forensics"
    filesystem = "ext4"
    image = "private/forensics"
    size = "2000"
    root_pass = "w04h_n311y"
  }

  disk {
     label = "swap"
     filesystem = "swap"
     size = "512"
  }

  config {
     label = "boot"
     kernel = "linode/latest-64bit"

     devices {
       sda = { disk_label = "root" }
       sdb = { disk_label = "swap" }
       sdc = { volume_id = "${linode_volume.foo.id}" }
     }
  }

  config {
     label = "forensics"
     kernel = "linode/latest-64bit"
     helpers {
       network = false
     }

     devices {
       sda = { disk_label = "forensics" }
       sdb = { disk_label = "boot" }
     }
  }

  boot_config = "boot"
}