You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository.
263
-
This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute.
264
+
NOTE: The configured default branch must exist in the repository.
265
+
If the branch doesn't exist yet, or if you are creating a new
266
+
repository, please add the desired default branch to the `branches`
267
+
variable, which will cause Terraform to create it for you.
264
268
265
269
Default is `""`.
266
270
@@ -416,6 +420,32 @@ This is due to some terraform limitation and we will update the module once terr
Can also be type `list(string)`. Create and manage branches within your repository.
428
+
Additional constraints can be applied to ensure your branch is created from another branch or commit.
429
+
Every `string` in the list will be converted internally into the `object` representation with the `name` argument being set to the `string`. `object` details are explained below.
430
+
431
+
Default is `[]`.
432
+
433
+
Each `branch` object in the list accepts the following attributes:
Copy file name to clipboardExpand all lines: README.tfdoc.hcl
+52-2Lines changed: 52 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ section {
65
65
Template Repository
66
66
67
67
- **Extended Repository Features**:
68
+
Branches,
68
69
Branch Protection,
69
70
Issue Labels,
70
71
Handle Github Default Issue Labels,
@@ -317,8 +318,10 @@ section {
317
318
default=""
318
319
description=<<-END
319
320
The name of the default branch of the repository.
320
-
NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository.
321
-
This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute.
321
+
NOTE: The configured default branch must exist in the repository.
322
+
If the branch doesn't exist yet, or if you are creating a new
323
+
repository, please add the desired default branch to the `branches`
324
+
variable, which will cause Terraform to create it for you.
322
325
END
323
326
}
324
327
@@ -529,6 +532,43 @@ section {
529
532
}
530
533
}
531
534
535
+
section {
536
+
title="Branches Configuration"
537
+
538
+
variable"branches" {
539
+
type=list(branch)
540
+
default=[]
541
+
description=<<-END
542
+
Can also be type `list(string)`. Create and manage branches within your repository.
543
+
Additional constraints can be applied to ensure your branch is created from another branch or commit.
544
+
Every `string` in the list will be converted internally into the `object` representation with the `name` argument being set to the `string`. `object` details are explained below.
545
+
END
546
+
547
+
attribute"name" {
548
+
required=true
549
+
type=string
550
+
description=<<-END
551
+
The name of the branch to create.
552
+
END
553
+
}
554
+
555
+
attribute"source_branch" {
556
+
type=string
557
+
description=<<-END
558
+
The branch name to start from. Uses the configured default branch per default.
559
+
END
560
+
}
561
+
562
+
attribute"source_sha" {
563
+
type=bool
564
+
default=true
565
+
description=<<-END
566
+
The commit hash to start from. Defaults to the tip of `source_branch`. If provided, `source_branch` is ignored.
567
+
END
568
+
}
569
+
}
570
+
}
571
+
532
572
section {
533
573
title="Deploy Keys Configuration"
534
574
@@ -1046,6 +1086,15 @@ section {
1046
1086
END
1047
1087
}
1048
1088
1089
+
output"branches" {
1090
+
type=object(branches)
1091
+
description=<<-END
1092
+
All repository attributes as returned by the [`github_branch`]
1093
+
resource containing all arguments as specified above and the other
0 commit comments