Pull jdormit-website ip address from remote state
This commit is contained in:
parent
2b8042d6b8
commit
2770cf5439
@ -4,6 +4,21 @@ 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"
|
||||
}
|
||||
}
|
||||
|
||||
# This domain is registered via Google Domains, so the nameservers
|
||||
# there need to point to DO's nameservers
|
||||
resource "digitalocean_domain" "jeremydormitzer_com" {
|
||||
@ -17,7 +32,7 @@ resource "digitalocean_record" "top_level_a" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
name = "@"
|
||||
value = "67.205.191.63"
|
||||
value = data.terraform_remote_state.jdormit_website.outputs.jdormit_website_ip_address
|
||||
ttl = 3600
|
||||
}
|
||||
|
||||
@ -25,7 +40,7 @@ resource "digitalocean_record" "www" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
name = "www"
|
||||
value = "67.205.191.63"
|
||||
value = data.terraform_remote_state.jdormit_website.outputs.jdormit_website_ip_address
|
||||
ttl = 3600
|
||||
}
|
||||
|
||||
@ -91,6 +106,6 @@ resource "digitalocean_record" "wallabag" {
|
||||
domain = digitalocean_domain.jeremydormitzer_com.name
|
||||
type = "A"
|
||||
name = "wallabag"
|
||||
value = "67.205.191.63"
|
||||
value = data.terraform_remote_state.jdormit_website.outputs.jdormit_website_ip_address
|
||||
ttl = 3600
|
||||
}
|
||||
|
@ -11,3 +11,7 @@ resource "digitalocean_droplet" "jdormit_website" {
|
||||
size = "s-1vcpu-1gb"
|
||||
backups = true
|
||||
}
|
||||
|
||||
output "jdormit_website_ip_address" {
|
||||
value = digitalocean_droplet.jdormit_website.ipv4_address
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user