Skip to content

Commit 6448916

Browse files
committed
feat: add repository template
1 parent 1085f1a commit 6448916

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ repositories:
115115
- another-topic
116116
# Properties
117117
is_template: true # OPTIONAL, DEFAULT false
118+
# Contents
119+
template: # OPTIONAL, DEFAULT none
120+
owner: bruzit
121+
repository: template
122+
include_all_branches: true # OPTIONAL, DEFAULT false
118123
```
119124

120125
Set it as source of truth:

terraform/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,18 @@ resource "github_repository" "this" {
1414

1515
# Properties
1616
is_template = try(each.value.is_template, null)
17+
18+
# Contents
19+
dynamic "template" {
20+
for_each = (
21+
try(each.value.template, null) != null &&
22+
length(try(each.value.template, {})) > 0
23+
) ? [each.value.template] : []
24+
25+
content {
26+
owner = template.value.owner
27+
repository = template.value.repository
28+
include_all_branches = try(template.value.include_all_branches, false)
29+
}
30+
}
1731
}

test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ repositories:
1111
topics:
1212
- repository-template
1313
is_template: true
14+
- name: template-use
15+
template:
16+
owner: bruzit-test
17+
repository: template

0 commit comments

Comments
 (0)