Ver código fonte

after first pretest stream contents.

Added a bit more for the .gitignore to ignore state files from terraform.
master
Mitch Tishmack 6 anos atrás
pai
commit
d6b932aeba
3 arquivos alterados com 48 adições e 0 exclusões
  1. +4
    -0
      .gitignore
  2. +33
    -0
      main.tf
  3. +11
    -0
      variables.tf

+ 4
- 0
.gitignore Ver arquivo

@@ -0,0 +1,4 @@
terraform.tfvars
.terraform
terraform.tfstate
terraform.tfstate.backup

+ 33
- 0
main.tf Ver arquivo

@@ -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 = [<<FIN
uname -a
FIN
]
}
}

+ 11
- 0
variables.tf Ver arquivo

@@ -0,0 +1,11 @@
variable "ssh_pub_key" {
type = string
}

variable "linode_token" {
type = string
}

variable "root_password" {
type = string
}

Carregando…
Cancelar
Salvar