Load project resources from terraform remote state
This commit is contained in:
parent
3db3fa2399
commit
cabad59c81
44
mgmt/do-jeremydormitzer-com/data.tf
Normal file
44
mgmt/do-jeremydormitzer-com/data.tf
Normal file
@ -0,0 +1,44 @@
|
||||
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" {
|
||||
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/git-jeremydormitzer-com.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "syncthing" {
|
||||
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/syncthing.tfstate"
|
||||
}
|
||||
}
|
@ -4,51 +4,6 @@ provider "digitalocean" {
|
||||
spaces_secret_key = var.spaces_secret_key
|
||||
}
|
||||
|
||||
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" {
|
||||
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/git-jeremydormitzer-com.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "syncthing" {
|
||||
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/syncthing.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
# This domain is registered via Google Domains, so the nameservers
|
||||
# there need to point to DO's nameservers
|
||||
resource "digitalocean_domain" "jeremydormitzer_com" {
|
||||
|
3
mgmt/do-jeremydormitzer-com/outputs.tf
Normal file
3
mgmt/do-jeremydormitzer-com/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "jeremydormitzer_com_urn" {
|
||||
value = digitalocean_domain.jeremydormitzer_com.urn
|
||||
}
|
74
mgmt/do-project-jeremydormitzer/data.tf
Normal file
74
mgmt/do-project-jeremydormitzer/data.tf
Normal file
@ -0,0 +1,74 @@
|
||||
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" {
|
||||
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/git-jeremydormitzer-com.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "syncthing" {
|
||||
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/syncthing.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "justin_ghost_site" {
|
||||
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/justin-ghost-site.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
data "terraform_remote_state" "jeremydormitzer_com" {
|
||||
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-dns.tfstate"
|
||||
}
|
||||
}
|
@ -9,4 +9,12 @@ resource "digitalocean_project" "jeremy_dormitzer" {
|
||||
environment = "Production"
|
||||
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.syncthing.outputs.syncthing_urn,
|
||||
data.terraform_remote_state.syncthing.outputs.syncthing_volume_urn,
|
||||
data.terraform_remote_state.justin_ghost_site.outputs.justin_ghost_site_urn,
|
||||
data.terraform_remote_state.jeremydormitzer_com.outputs.jeremydormitzer_com_urn
|
||||
]
|
||||
}
|
||||
|
@ -11,7 +11,3 @@ resource "digitalocean_droplet" "git_jeremydormitzer_com" {
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
}
|
||||
|
||||
output "git_ip_address" {
|
||||
value = digitalocean_droplet.git_jeremydormitzer_com.ipv4_address
|
||||
}
|
||||
|
7
prod/git-jeremydormitzer-com/outputs.tf
Normal file
7
prod/git-jeremydormitzer-com/outputs.tf
Normal file
@ -0,0 +1,7 @@
|
||||
output "git_ip_address" {
|
||||
value = digitalocean_droplet.git_jeremydormitzer_com.ipv4_address
|
||||
}
|
||||
|
||||
output "git_urn" {
|
||||
value = digitalocean_droplet.git_jeremydormitzer_com.urn
|
||||
}
|
@ -11,7 +11,3 @@ resource "digitalocean_droplet" "jdormit_website" {
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
}
|
||||
|
||||
output "jdormit_website_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_website.ipv4_address
|
||||
}
|
||||
|
7
prod/jdormit-website/outputs.tf
Normal file
7
prod/jdormit-website/outputs.tf
Normal file
@ -0,0 +1,7 @@
|
||||
output "jdormit_website_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_website.ipv4_address
|
||||
}
|
||||
|
||||
output "jdormit_website_urn" {
|
||||
value = digitalocean_droplet.jdormit_website.urn
|
||||
}
|
3
prod/justin-ghost-site/outputs.tf
Normal file
3
prod/justin-ghost-site/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "justin_ghost_site_urn" {
|
||||
value = digitalocean_droplet.justin_ghost_site.urn
|
||||
}
|
@ -18,7 +18,3 @@ resource "digitalocean_volume" "syncthing_volume" {
|
||||
region = "nyc1"
|
||||
size = 100
|
||||
}
|
||||
|
||||
output "syncthing_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.ipv4_address
|
||||
}
|
||||
|
11
prod/syncthing/outputs.tf
Normal file
11
prod/syncthing/outputs.tf
Normal file
@ -0,0 +1,11 @@
|
||||
output "syncthing_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.ipv4_address
|
||||
}
|
||||
|
||||
output "syncthing_urn" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.urn
|
||||
}
|
||||
|
||||
output "syncthing_volume_urn" {
|
||||
value = digitalocean_volume.syncthing_volume.urn
|
||||
}
|
Loading…
Reference in New Issue
Block a user