Resource: yet_cloud_database_attachment
An environment's database — yet_cloud_database — handed to an application on its stage there, in a variable. Its other stages are not handed it.
Note: The application must have a stage on the database's environment, and no other variable of that name — its own env, a database of its own, another attachment.
Example Usage
resource "yet_cloud_database" "ledger" {
kind = "overlite"
name = "ledger"
environment_id = yet_cloud_environment.production.id
}
# The production ledger, handed to the API on its production stage.
resource "yet_cloud_database_attachment" "api_ledger" {
application_id = yet_cloud_application.api.id
database_id = yet_cloud_database.ledger.id
env_var = "LEDGER_URL"
}Schema
Required
application_id(String) The application it is handed to.database_id(String) The environment's database.
Optional
env_var(String) The variable it is handed in — capitals, digits and underscores: the database's own,DATABASE_URLorREDIS_URL, unless set.
Read-Only
id(String)<application_id>/<database_id>.
Import
In Terraform v1.5.0 and later, with an import block:
import {
to = yet_cloud_database_attachment.api_ledger
id = "01J9Z8K3V7Q2M4N6P8R0S2T4V6/01J9Z8M1A2B3C4D5E6F7G8H9J0"
}With terraform import:
# <application_id>/<database_id>
terraform import yet_cloud_database_attachment.api_ledger 01J9Z8K3V7Q2M4N6P8R0S2T4V6/01J9Z8M1A2B3C4D5E6F7G8H9J0