Remove old syncthing instance
This commit is contained in:
parent
fe1dde4ffe
commit
4b638634fa
@ -1,57 +0,0 @@
|
||||
provider "digitalocean" {
|
||||
token = var.do_token
|
||||
spaces_access_id = var.spaces_access_id
|
||||
spaces_secret_key = var.spaces_secret_key
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "do_ssh_keys" {
|
||||
backend = "s3"
|
||||
|
||||
config = {
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
access_key = var.spaces_access_id
|
||||
secret_key = var.spaces_secret_key
|
||||
region = "us-east-1"
|
||||
endpoint = "nyc3.digitaloceanspaces.com"
|
||||
bucket = "jdormit-tf-state"
|
||||
key = "mgmt/do-ssh-keys.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "local_file" "packer_manifest" {
|
||||
filename = "${path.module}/../packer/packer-manifest.json"
|
||||
}
|
||||
|
||||
locals {
|
||||
packer_manifest = jsondecode(data.local_file.packer_manifest.content)
|
||||
packer_builds = local.packer_manifest.builds
|
||||
packer_image_str = element(local.packer_builds, length(local.packer_builds) - 1).artifact_id
|
||||
packer_image = split(":", local.packer_image_str)[1]
|
||||
}
|
||||
|
||||
resource "digitalocean_droplet" "syncthing" {
|
||||
name = "syncthing"
|
||||
image = local.packer_image
|
||||
region = "nyc1"
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
volume_ids = [digitalocean_volume.syncthing_volume.id]
|
||||
ssh_keys = [
|
||||
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_laptop_ssh_key_id,
|
||||
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_macbook_lola_ssh_key_id
|
||||
]
|
||||
}
|
||||
|
||||
resource "digitalocean_volume" "syncthing_volume" {
|
||||
name = "syncthing-volume"
|
||||
description = "The volume to hold the default Sync folder"
|
||||
region = "nyc1"
|
||||
size = 100
|
||||
initial_filesystem_label = "syncthing-volume"
|
||||
initial_filesystem_type = "ext4"
|
||||
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
output "ip_address" {
|
||||
value = digitalocean_droplet.syncthing.ipv4_address
|
||||
}
|
||||
|
||||
output "urn" {
|
||||
value = digitalocean_droplet.syncthing.urn
|
||||
}
|
||||
|
||||
output "volume_urn" {
|
||||
value = digitalocean_volume.syncthing_volume.urn
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
digitalocean = {
|
||||
source = "digitalocean/digitalocean"
|
||||
version = "~> 2.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
backend "s3" {
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
# Need to specify an AWS region to stop Terraform complaining
|
||||
region = "us-east-1"
|
||||
endpoint = "nyc3.digitaloceanspaces.com"
|
||||
bucket = "jdormit-tf-state"
|
||||
key = "prod/syncthing-packer.tfstate"
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
variable "do_token" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "spaces_access_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "spaces_secret_key" {
|
||||
type = string
|
||||
}
|
@ -1 +0,0 @@
|
||||
export ANSIBLE_INVENTORY="$(expand_path hosts.ini)"
|
@ -1 +0,0 @@
|
||||
syncthing.jeremydormitzer.com
|
@ -4,17 +4,54 @@ provider "digitalocean" {
|
||||
spaces_secret_key = var.spaces_secret_key
|
||||
}
|
||||
|
||||
resource "digitalocean_droplet" "jdormit_syncthing" {
|
||||
name = "jdormit-syncthing"
|
||||
image = "53893572"
|
||||
data "terraform_remote_state" "do_ssh_keys" {
|
||||
backend = "s3"
|
||||
|
||||
config = {
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
access_key = var.spaces_access_id
|
||||
secret_key = var.spaces_secret_key
|
||||
region = "us-east-1"
|
||||
endpoint = "nyc3.digitaloceanspaces.com"
|
||||
bucket = "jdormit-tf-state"
|
||||
key = "mgmt/do-ssh-keys.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "local_file" "packer_manifest" {
|
||||
filename = "${path.module}/../packer/packer-manifest.json"
|
||||
}
|
||||
|
||||
locals {
|
||||
packer_manifest = jsondecode(data.local_file.packer_manifest.content)
|
||||
packer_builds = local.packer_manifest.builds
|
||||
packer_image_str = element(local.packer_builds, length(local.packer_builds) - 1).artifact_id
|
||||
packer_image = split(":", local.packer_image_str)[1]
|
||||
}
|
||||
|
||||
resource "digitalocean_droplet" "syncthing" {
|
||||
name = "syncthing"
|
||||
image = local.packer_image
|
||||
region = "nyc1"
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
volume_ids = [digitalocean_volume.syncthing_volume.id]
|
||||
ssh_keys = [
|
||||
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_laptop_ssh_key_id,
|
||||
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_macbook_lola_ssh_key_id
|
||||
]
|
||||
}
|
||||
|
||||
resource "digitalocean_volume" "syncthing_volume" {
|
||||
name = "volume-nyc1-01"
|
||||
region = "nyc1"
|
||||
size = 100
|
||||
name = "syncthing-volume"
|
||||
description = "The volume to hold the default Sync folder"
|
||||
region = "nyc1"
|
||||
size = 100
|
||||
initial_filesystem_label = "syncthing-volume"
|
||||
initial_filesystem_type = "ext4"
|
||||
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
output "syncthing_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.ipv4_address
|
||||
output "ip_address" {
|
||||
value = digitalocean_droplet.syncthing.ipv4_address
|
||||
}
|
||||
|
||||
output "syncthing_urn" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.urn
|
||||
output "urn" {
|
||||
value = digitalocean_droplet.syncthing.urn
|
||||
}
|
||||
|
||||
output "syncthing_volume_urn" {
|
||||
output "volume_urn" {
|
||||
value = digitalocean_volume.syncthing_volume.urn
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ terraform {
|
||||
region = "us-east-1"
|
||||
endpoint = "nyc3.digitaloceanspaces.com"
|
||||
bucket = "jdormit-tf-state"
|
||||
key = "prod/syncthing.tfstate"
|
||||
key = "prod/syncthing-packer.tfstate"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user