Resource

dcloud_app_cache_binding

Binds a managed Valkey cache to an app: every rollout generates {prefix}REDIS_URL and {prefix}VALKEY_URL with the cache's private address. The app's machines must run in the cache's VPC.

Example Usage

resource "dcloud_app_cache_binding" "sessions" {
  app_id           = dcloud_app.web.id
  cache_cluster_id = dcloud_cache_cluster.sessions.id
  env_prefix       = "SESSIONS_"
}

Schema

Required

  • app_id (String) The id of the parent resource ({id} in the path). Changing it replaces the resource.
  • cache_cluster_id (String) The managed Valkey cache to bind. Must match ^ewc-[0-9a-f]{12}$.

Optional

  • env_prefix (String) Prefix of the generated variables (ANALYTICS_ → ANALYTICS_DATABASE_URL); default none. An app has one cache binding per prefix. Import id: <app-id>/<prefix>. Changing it replaces the resource.
  • redeploy (Boolean) Start a deployment so the app gets the variables at once. Never returned by the API: not read back, and empty after an import.

Read-Only

  • generated_keys (List of String) The variables the binding generates.
  • id (String) The resource's id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_app_cache_binding.sessions <app-id>/SESSIONS_

Generated from the provider's schema.