Pull remaining droplet IPs from remote state
This commit is contained in:
parent
2770cf5439
commit
3db3fa2399
@ -19,15 +19,42 @@ data "terraform_remote_state" "jdormit_website" {
|
||||
}
|
||||
}
|
||||
|
||||
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" {
|
||||
name = "jeremydormitzer.com"
|
||||
}
|
||||
|
||||
# TODO once these services are managed by Terraform, update the IP
|
||||
# addresses to pull from Terraform state
|
||||
|
||||
resource "digitalocean_record" "top_level_a" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
@ -64,7 +91,7 @@ resource "digitalocean_record" "git" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
name = "git"
|
||||
value = "159.203.78.16"
|
||||
value = data.terraform_remote_state.git_jeremydormitzer_com.outputs.git_ip_address
|
||||
ttl = 3600
|
||||
}
|
||||
|
||||
@ -98,7 +125,7 @@ resource "digitalocean_record" "syncthing" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
name = "syncthing"
|
||||
value = "198.199.86.10"
|
||||
value = data.terraform_remote_state.syncthing.outputs.syncthing_ip_address
|
||||
ttl = 3600
|
||||
}
|
||||
|
||||
|
@ -11,3 +11,7 @@ resource "digitalocean_droplet" "git_jeremydormitzer_com" {
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
}
|
||||
|
||||
output "git_ip_address" {
|
||||
value = digitalocean_droplet.git_jeremydormitzer_com.ipv4_address
|
||||
}
|
||||
|
@ -18,3 +18,7 @@ resource "digitalocean_volume" "syncthing_volume" {
|
||||
region = "nyc1"
|
||||
size = 100
|
||||
}
|
||||
|
||||
output "syncthing_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_syncthing.ipv4_address
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user