New to Kestra?
Use blueprints to kickstart your first workflows.
Run Terraform, upsert the provisioned IP into a Cloudflare A record, purge the cache, and notify Slack. Keep DNS in sync with infrastructure on Kestra.
Keep your Cloudflare DNS records in lockstep with the infrastructure Terraform provisions. Every time a server, load balancer, or instance changes its public IP, this Kestra blueprint reapplies Terraform, reads the new IP, and upserts the matching Cloudflare A record so traffic always reaches the current origin. It closes the gap between infrastructure as code and DNS that usually requires a manual edit in the Cloudflare dashboard or a brittle glue script. The flow purges the Cloudflare cache for the hostname so clients pick up the change immediately, then posts a confirmation to Slack for an auditable record of every DNS update.
provision task (io.kestra.plugin.terraform.cli.TerraformCLI) runs inside a Docker task runner on the hashicorp/terraform:latest image. It runs terraform init, then terraform apply -auto-approve, and writes the instance_ip output to ip.txt via outputFiles.upsert_dns task (io.kestra.plugin.cloudflare.dns.records.Upsert) reads ip.txt, trims it, and creates or updates the A record named from inputs.record_name in the zone given by inputs.zone_id, with proxied: true.purge_cache task (io.kestra.plugin.cloudflare.cache.Purge) purges the cached responses for https://{record_name}/ so the new origin takes effect right away.notify task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts the record name, new IP (outputs.upsert_dns.content), and the action taken to Slack.Schedule trigger (nightly_sync) is wired to reconcile DNS with infrastructure every night at 0 1 * * *. Enable it to run unattended.Terraform can provision infrastructure but has no native scheduler, no retry semantics across external systems, and no built-in way to react to events or chain a DNS update, cache purge, and notification after an apply. Kestra adds event and schedule triggers, automatic retries, full execution lineage across Terraform, Cloudflare, and Slack, and a single declarative YAML definition you can version and review. The result is a reconciliation loop that runs reliably on its own rather than depending on someone remembering to update DNS by hand.
instance_ip (the blueprint ships a stub you replace with your real infrastructure).CLOUDFLARE_API_TOKEN: Cloudflare token with DNS edit and cache purge permissions, used by both Cloudflare tasks via pluginDefaults.SLACK_WEBHOOK_URL: Slack incoming webhook URL for the notification.CLOUDFLARE_API_TOKEN and SLACK_WEBHOOK_URL as secrets in your Kestra namespace.main.tf with your real Terraform, keeping an instance_ip output.zone_id and record_name inputs.proxied: false on upsert_dns for a DNS-only record instead of a proxied one.recordType to manage AAAA, CNAME, or other record types.nightly_sync Schedule trigger, or swap it for a webhook or flow trigger to reconcile DNS on every deploy.