Source
id: create-repository
namespace: company.team
inputs:
- id: repository_name
type: STRING
- id: description
type: STRING
tasks:
- id: terraform
type: io.kestra.plugin.terraform.cli.TerraformCLI
inputFiles:
main.tf: |
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.0"
}
}
}
provider "github" {
token = "{{ secret('GITHUB_TOKEN') }}"
}
resource "github_repository" "{{inputs.repository_name}}" {
name = "{{inputs.repository_name}}"
description = "{{ inputs.description }}"
auto_init = true
visibility = "public"
}
beforeCommands:
- terraform init
commands:
- terraform plan 2>&1 | tee plan_output.txt
- terraform apply -auto-approve 2>&1 | tee apply_output.txt
outputFiles:
- "*.txt"
About this blueprint
Infrastructure
This blueprint demonstrates how to provision GitHub repositories as code using Terraform orchestrated by Kestra, enabling a fully automated and reproducible repository creation workflow. It shows how to:
- Use the official Terraform GitHub provider to declaratively manage GitHub repositories.
- Create GitHub repositories automatically with predefined metadata such as name, description, visibility, and initialization settings.
- Authenticate securely with GitHub using a Personal Access Token managed as a Kestra secret.
- Integrate repository provisioning into broader GitOps, platform engineering, or developer self-service workflows.
- Capture Terraform execution outputs for auditing, debugging, or downstream automation steps.
This blueprint intentionally runs Terraform without a remote backend, making it suitable for one-off executions, bootstrap workflows, or repository scaffolding use cases. For long-lived infrastructure management, you should configure a Terraform backend to persist the Terraform state. To authenticate with GitHub, you will need a GitHub API token. Refer to the official documentation on how to create a Personal GitHub Token.
More Related Blueprints