My app has a top-level domain bee-ci.pacia.tech, and I set the zone of my digitalocean_app.app to that that domain (=bee-ci.pacia.tech).
I want for my app to be available at subdomain backend.bee-ci.pacia.tech. For this I create a new digitalocean_record.backend, but to get the ingress address for my app, I have to write this which I think is a bit convoluted:
resource "digitalocean_project" "project" {
name = "bee-ci-proj-tf"
description = "A simple container-based CI system"
environment = "Development"
resources = [
digitalocean_app.app.urn,
digitalocean_database_cluster.main-db-cluster.urn,
digitalocean_domain.main.urn,
]
}
resource "digitalocean_app" "app" {
spec {
name = "bee-ci-tf"
region = "sfo"
domain {
name = "backend.bee-ci.pacia.tech"
type = "PRIMARY"
zone = digitalocean_domain.main.name
}
# ...
}
resource "digitalocean_domain" "main" {
name = "bee-ci.pacia.tech"
}
resource "digitalocean_record" "backend" {
domain = digitalocean_domain.main.id
type = "CNAME"
name = "backend"
value = format("%s.", split("://", digitalocean_app.app.default_ingress)[1])
# value = "bee-ci.pacia.tech." # this is the value I want
}
My app has a top-level domain
bee-ci.pacia.tech
, and I set the zone of mydigitalocean_app.app
to that that domain (=bee-ci.pacia.tech
).I want for my app to be available at subdomain
backend.bee-ci.pacia.tech
. For this I create a newdigitalocean_record.backend
, but to get the ingress address for my app, I have to write this which I think is a bit convoluted:Is there a better way?
Here's my full
main.tf
: