Get DO project terraform synced up

This commit is contained in:
Jeremy Dormitzer 2021-01-26 22:47:14 -05:00
parent f5e4767c3f
commit 4d7bc558eb
6 changed files with 66 additions and 37 deletions

View File

@ -1,19 +1,4 @@
data "terraform_remote_state" "jdormit_website" {
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 = "prod/jdormit-website.tfstate"
}
}
data "terraform_remote_state" "git_jeremydormitzer_com" {
data "terraform_remote_state" "gitea" {
backend = "s3"
config = {
@ -72,3 +57,33 @@ data "terraform_remote_state" "jeremydormitzer_com" {
key = "mgmt/do-dns.tfstate"
}
}
data "terraform_remote_state" "spaces" {
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-spaces.tfstate"
}
}
data "terraform_remote_state" "wallabag" {
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 = "prod/wallabag.tfstate"
}
}

View File

@ -10,12 +10,13 @@ resource "digitalocean_project" "jeremy_dormitzer" {
description = "Personal infrastructure"
purpose = "Personal infrastructure"
resources = [
data.terraform_remote_state.jdormit_website.outputs.jdormit_website_urn,
data.terraform_remote_state.git_jeremydormitzer_com.outputs.git_urn,
data.terraform_remote_state.git_jeremydormitzer_com.outputs.gitea_urn,
data.terraform_remote_state.gitea.outputs.gitea_urn,
data.terraform_remote_state.gitea.outputs.gitea_volume_urn,
data.terraform_remote_state.syncthing.outputs.urn,
data.terraform_remote_state.syncthing.outputs.volume_urn,
data.terraform_remote_state.justin_ghost_site.outputs.justin_ghost_site_urn,
data.terraform_remote_state.jeremydormitzer_com.outputs.jeremydormitzer_com_urn
data.terraform_remote_state.jeremydormitzer_com.outputs.jeremydormitzer_com_urn,
data.terraform_remote_state.spaces.outputs.jdormit_infra_bucket_urn,
data.terraform_remote_state.wallabag.outputs.urn
]
}

View File

@ -0,0 +1,23 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/digitalocean/digitalocean" {
version = "2.3.0"
constraints = "~> 2.3.0"
hashes = [
"h1:Kmcj3ajzt/lSQkbQwcjzUNK2RXXcHNDCs44LfDhZnaM=",
"zh:1c0f68715cf0b84ab40ab08aa59232037325cffc2896ba109cae73c81ab021e9",
"zh:306599aec6637c92349abb069d8fea3ebac58f52f61707956320a405f57e4a84",
"zh:31db532f05e55cb52d61c12c10197dca48dc8809a4f9cc4a935d3161546968ca",
"zh:3dba438c0167e5dcf09115f8d2c33c0a821e6b27e83ec6ccaac5fcb557a50bbb",
"zh:770c906ab3eeb5c24c5b8bbcca3b18f137d5ac817bd73fa5c9146eb4a9d891d6",
"zh:9221f2d275c776382234882d534a1147db04a8be490c023eb08c9a1e579db021",
"zh:a4e25e5dd2ad06de6c7148a270b1178b6298846405ce66b9b4ca51ea35b66907",
"zh:b3c5555e0c55efaa91de245e6d69e7140665554d2365db2f664802a36b59e0a8",
"zh:c510655b6c5de0227babba5a8bb66a8c3d92af94e080ec1c39bde9509a2aa1a6",
"zh:d04a135d9bf32c1a55abaaeb719903f4f67797434dd6d9f3219245f62a9a66be",
"zh:dd5b99bec9425eb670be5d19b17336d0fa9b894649dac77eac532e4c626616f5",
"zh:e57614fb9f3fbf774a9258a197840f40d0f343e8183eef7a842286a87cfc48d7",
"zh:fee52e736edc5ef4088cedae6507790f35e4ee8a078bff1ef894a51dd65d058d",
]
}

View File

@ -0,0 +1,3 @@
output "jdormit_infra_bucket_urn" {
value = digitalocean_spaces_bucket.jdormit_tf_state.urn
}

View File

@ -4,15 +4,6 @@ provider "digitalocean" {
spaces_secret_key = var.spaces_secret_key
}
resource "digitalocean_droplet" "git_jeremydormitzer_com" {
name = "git.jeremydormitzer.com"
image = "41695378"
region = "nyc3"
size = "s-1vcpu-1gb"
backups = true
tags = ["terraform"]
}
module "packer_droplet" {
source = "../../../terraform-modules/packer_droplet"
name = "gitea"

View File

@ -1,11 +1,3 @@
output "git_ip_address" {
value = digitalocean_droplet.git_jeremydormitzer_com.ipv4_address
}
output "git_urn" {
value = digitalocean_droplet.git_jeremydormitzer_com.urn
}
output "gitea_ip_address" {
value = module.packer_droplet.droplet_ip_address
}
@ -13,3 +5,7 @@ output "gitea_ip_address" {
output "gitea_urn" {
value = module.packer_droplet.droplet_urn
}
output "gitea_volume_urn" {
value = digitalocean_volume.gitea_volume.urn
}