Ignitify.dev
ignitify_deployment
Terraform

ignitify_deployment

The deployed code of a task: the files of a task folder, uploaded and built by the server. A change of the files uploads them again and waits for the build. Needs tasks.read, deployments.read and deployments.write. The notify fields also need hooks.write.

Example

app.tf
resource "ignitify_task" "report" {
  slug = "report"
}

# A change of the files in source_dir uploads them and waits for the build.
# The old deployment is deleted once the new one is READY.
resource "ignitify_deployment" "report" {
  task       = ignitify_task.report.slug
  source_dir = "${path.module}/report"

  timeouts = {
    create = "45m"
    update = "45m"
  }
}

Arguments and attributes

NameTypeUseMeaning
taskStringRequiredforces replacement · import idThe slug of the task. It must equal the slug in the folder's task config.
source_dirStringRequiredThe task folder. The upload holds the files a deploy selects. See "Which files are uploaded" below.
notify_urlStringOptionalAn HTTPS URL the deployment calls when a run ends. Unset clears it. Needs notify_secret_wo.
notify_secret_woStringOptionalsensitive · write-onlyThe key that signs each notify call. At least 32 characters. Terraform cannot see a change of it, so change notify_secret_wo_version to send it again.
notify_secret_wo_versionNumberOptionalAny number. A change sends notify_url and notify_secret_wo again.
timeoutsObjectOptionalHow long the apply waits for the build: create and update, each a duration such as "30m" or "1h". The default is 30 minutes.
deployment_idStringRead-onlyThe server id of the live deployment. Unknown in a plan that uploads.
statusStringRead-onlyThe deployment status. READY after a successful apply. Any other status uploads again at the next apply.
source_hashStringRead-onlyA digest of the selected files, computed at plan time. A change uploads the files again.
content_hashStringRead-onlyThe server's content key of the deployment.
executionStringRead-onlyThe execution block of the task config, as JSON. Null when the config declares none.
secretsList of StringRead-onlyThe secret names the task config declares. Null when it declares none.

Which files are uploaded

At plan time the provider selects the files as task:deploy does.

  • Left out: .env files, vendored dependencies, local state, and the paths your .ignitifyignore excludes.
  • Refused: a symbolic link, a registry credential in .npmrc or .yarnrc.yml, a missing lockfile or entry file, and a folder over the upload size.
  • Warned about: excluded files, and file names that look like private keys.

A code update

  • The same code and the same task config reuse the same deployment.
  • A failed or timed-out build keeps the old deployment. The error shows the reason, the provider deletes the deployment that did not become ready, and the next plan uploads again.
  • If the old deployment cannot be deleted, the new one is live and in the state, and the error names the old one. Delete it with ignitify deployment:delete <deployment-id>.
  • Do not use create_before_destroy on this resource. The same code gives the same deployment back, and the destroy step would delete the live one.

Deployment slots

Your plan allows a set number of live deployments. An update builds the new deployment before it deletes the old one, so an update needs one free slot. When all slots are used, the upload is refused with a plan-limit error. Delete a deployment you do not need (ignitify deployment:list shows them), or use a bigger plan. ignitify_whoami shows how many you hold (usage.deployment_count).

A build also uses the plan's monthly compute. When it is spent, an upload that needs a build is refused (monthly-compute-quota) until the allowance resets; the old deployment keeps serving.

Notify callback

A deployment can call your HTTPS endpoint when a run ends, as notify:set does. Every new deployment gets the callback again, and removing notify_url clears it. The plan refuses notify_url when your plan has no webhooks.

notify.tf
variable "notify_secret" {
  type      = string
  sensitive = true
  ephemeral = true
}

resource "ignitify_deployment" "report" {
  task       = ignitify_task.report.slug
  source_dir = "${path.module}/report"

  notify_url               = "https://your-domain.example/ignitify"
  notify_secret_wo         = var.notify_secret
  notify_secret_wo_version = 1
}

Import

The import id is the task slug, when the task has exactly one live deployment. Otherwise name the deployment: <task slug>/<deployment id>.

terminal
$ terraform import ignitify_deployment.report report

The state has no source_dir after an import, so the first apply uploads the folder. The same code reuses the same deployment.