-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-repository.yaml
62 lines (55 loc) · 1.9 KB
/
create-repository.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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"
extend:
title: Create a GitHub Repository with Terraform
description: >
This blueprint showcase how to create a GitHub repository using [Terraform
GitHub
provider](https://registry.terraform.io/providers/integrations/github/latest).
Note: here we don't provide any Terraform state backend. Therefore, state
won't be persisted and the flow can only act as a one-off execution. Make
sure to configure the Terraform backend to persist the Terrafom state. This
blueprint is still useful if you want to quickly create a GitHub repository.
You will need a GitHub API token to authenticate with GitHub. Check the
corresponding documentation on how to create a [Personal GitHub
Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
tags:
- Git
- DevOps
ee: false
demo: false
meta_description: Create a GitHub repository using Terraform in Kestra.