Track new linode instance in terraform

The definition is pretty verbose. Apparently it does that if you create it through the UI
This commit is contained in:
Jake Howard 2020-12-05 13:25:50 +00:00
parent 6d75272d34
commit 48e23e8c00
Signed by: jake
GPG Key ID: 57AFB45680EDD477
6 changed files with 50 additions and 2 deletions

1
.gitignore vendored
View File

@ -152,3 +152,4 @@ override.tf.json
terraform/secrets.auto.tfvars
terraform/secrets.sh
terraform/.terraform.lock.hcl

View File

@ -0,0 +1,38 @@
resource "linode_instance" "grimes" {
label = "grimes"
region = "eu-central"
type = "g6-nanode-1"
private_ip = true
config {
kernel = "linode/grub2"
label = "My Ubuntu 20.04 LTS Disk Profile"
devices {
sda {
disk_label = "Ubuntu 20.04 LTS Disk"
}
sdb {
disk_label = "512 MB Swap Image"
}
}
}
disk {
filesystem = "ext4"
label = "Ubuntu 20.04 LTS Disk"
read_only = false
size = 25088
}
disk {
filesystem = "swap"
label = "512 MB Swap Image"
read_only = false
size = 512
}
timeouts {}
}

View File

@ -12,3 +12,7 @@ provider "cloudflare" {
provider "aws" {
region = "eu-west-2"
}
provider "linode" {
token = var.linode_api_token
}

View File

@ -12,5 +12,9 @@ terraform {
source = "hashicorp/aws"
version = "3.8.0"
}
linode = {
source = "linode/linode"
version = "1.13.4"
}
}
}

View File

@ -136,7 +136,7 @@ resource "cloudflare_record" "theorangeonenet_upload" {
resource "cloudflare_record" "theorangeonenet_plausible" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "plausible"
value = vultr_server.casey.main_ip
value = linode_instance.grimes.ip_address
type = "A"
ttl = 1
}
@ -144,7 +144,7 @@ resource "cloudflare_record" "theorangeonenet_plausible" {
resource "cloudflare_record" "theorangeonenet_plausible_bare" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "elbisualp"
value = vultr_server.casey.main_ip
value = linode_instance.grimes.ip_address
type = "A"
ttl = 1
}

View File

@ -1,5 +1,6 @@
variable "vultr_api_key" {}
variable "cloudflare_api_key" {}
variable "linode_api_token" {}
variable "walker_ip" {
default = "5.39.79.153"