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.
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.
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#
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).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.
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, …).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