diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a907ef5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +terraform.tfvars +.terraform +terraform.tfstate +terraform.tfstate.backup \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..7d6ca78 --- /dev/null +++ b/main.tf @@ -0,0 +1,33 @@ +provider "linode" { + token = var.linode_token +} + +resource "linode_instance" "functionalidiot_net" { + image = "linode/alpine3.11" + label = "functionalidiot.net" + group = "terraform" + region = "us-central" + type = "g6-nanode-1" + authorized_keys = [var.ssh_pub_key] + root_pass = var.root_password +} + +output "ipv4" { + value = "${linode_instance.functionalidiot_net.ip_address}" +} + +resource "null_resource" "post-setup" { + depends_on = [ linode_instance.functionalidiot_net ] + connection { + host = linode_instance.functionalidiot_net.ip_address + user = "root" + password = var.root_password + private_key = file("~/.ssh/id_rsa") + } + provisioner "remote-exec" { + inline = [<