runr_deployment (Resource)
The running deployment of a project. Creating it deploys a version (default: the latest) or, for caas projects, an image; changing version_id, image or triggers deploys again in place (the previous deployment is shut down by RunR once the new one is ready). Destroying it tears the deployment down. With environment it is the running deployment of one of the project's environments.
Code of faas/xaas projects is uploaded as versions with runr deploy; put a value that changes with the code or config (a commit SHA, runr_env_var values) into triggers to redeploy.
A deploy of a project with a blue-green or canary deploy strategy (runr_project.deploy_strategy) opens a rollout while another deployment serves: the new deployment is running next to it until the rollout promotes it (active). Promoting, aborting and rolling back stay with runr rollout, the console or the API; a deployment whose rollout was aborted or rolled back drops out of the state, and the next apply deploys again.
Example Usage#
# Deploy the latest uploaded version of a function and redeploy when its
# variables change.
resource "runr_deployment" "api" {
project_id = runr_project.api.id
triggers = {
log_level = runr_env_var.log_level.value
}
}
# Deploy a container image.
resource "runr_deployment" "web" {
project_id = runr_project.web.id
image = "ghcr.io/acme/web:${var.web_version}"
timeout = "15m"
}
variable "web_version" {
type = string
default = "1.4.2"
}
output "web_url" {
value = runr_deployment.web.url
}
Schema#
Required#
project_id(String) Project id.
Optional#
environment(String) Environment of the project to deploy into, by name or id (runr_environment.<x>.name); left out orproduction: the project's own workload. It deploys with the environment's configuration; moving it replaces the deployment. Promoting a version from one environment to the next stays an action (runr promote).image(String)caas: image to deploy; it is written to the project config (a new version) first.timeout(String) How long to wait for the build and the deployment (Go duration, default10m).triggers(Map of String) Arbitrary values; any change deploys again.version_id(String) Version to deploy (default: the latest version when the deployment is created).wait(Boolean) Wait until the deployment serves (defaulttrue); with a deploy strategy, until the new revision is ready and its rollout under way.
Read-Only#
id(String) Id of the current deployment (changes on every redeploy).ready_at(String) When the deployment became ready (RFC 3339).status(String) Deployment status (active,pending, …;runningwhile a rollout of the deploy strategy is under way).url(String) Project URL (HTTP trigger).version_label(String) Deployed version label (v7).
Import#
Import is supported using the following syntax:
The terraform import command can be used, for example:
# The live deployment of a project, or <project>/<deployment id>
terraform import runr_deployment.api orders-api