Skip to content

Commit e341508

Browse files
Merge pull request #67 from mineiros-io/soerenmartius/add-gh-pages
Add GitHub Pages configuration block
2 parents 8e4aff4 + 80c4d66 commit e341508

File tree

6 files changed

+125
-58
lines changed

6 files changed

+125
-58
lines changed

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.9.1]
11+
12+
### Added
13+
14+
- Add support for GitHub Pages configuration in repositories
15+
1016
## [0.9.0]
1117

1218
### Added
@@ -244,12 +250,13 @@ Please review plans and report regressions and issues asap so we can improve doc
244250

245251
<!-- markdown-link-check-disable -->
246252

247-
[unreleased]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.0...HEAD
248-
[0.9.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.8.0...v0.9.0
249-
[0.8.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.7.0...v0.8.0
253+
[unreleased]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.1...HEAD
254+
[0.9.1]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.0...v0.9.1
250255

251256
<!-- markdown-link-check-enable -->
252257

258+
[0.9.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.8.0...v0.9.0
259+
[0.8.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.7.0...v0.8.0
253260
[0.7.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.6.1...v0.7.0
254261
[0.6.1]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.6.0...v0.6.1
255262
[0.6.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.5.1...v0.6.0

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ _Version `>= 0.8.0` of this module is compatible with `mineiros-io/team/github >
3535
- [Secrets Configuration](#secrets-configuration)
3636
- [`defaults` Object Attributes](#defaults-object-attributes)
3737
- [`template` Object Attributes](#template-object-attributes)
38+
- [`pages` Object Attributes](#pages-object-attributes)
3839
- [`deploy_key` Object Attributes](#deploy_key-object-attributes)
3940
- [`branch_protection` Object Attributes](#branch_protection-object-attributes)
4041
- [`required_status_checks` Object Attributes](#required_status_checks-object-attributes)
@@ -128,6 +129,12 @@ See [variables.tf] and [examples/] for details and use-cases.
128129
See below for a list of supported arguments.
129130
Default is `{}` - use module defaults as described in the README.
130131

132+
- **[`pages`](#pages-object-attributes)**: _(Optional `object`)_
133+
134+
A object of settings to configure GitHub Pages in this repository.
135+
See below for a list of supported arguments.
136+
Default is `null`.
137+
131138
- **`allow_merge_commit`**: _(Optional `bool`)_
132139

133140
Set to `false` to disable merge commits on the repository.
@@ -459,6 +466,26 @@ Module defaults are used for all arguments that are not set in `defaults`.
459466
Using top level arguments override defaults set by this argument.
460467
Default is `{}`.
461468

469+
#### [`pages`](#pages-object-attributes) Object Attributes
470+
471+
This block is used for configuring GitHub Pages for the repository.
472+
The following top-level arguments must be set to configure GitHub Pages for
473+
the repository:
474+
475+
- **`branch`**: **_(Required `string`)_**
476+
477+
The repository branch used to publish the site's source files.
478+
479+
- **`path`**: **_(Optional `string`)_**
480+
481+
The repository directory from which the site publishes.
482+
483+
- **`cname`**: **_(Optional `string`)_**
484+
485+
The custom domain for the repository. This can only be set after the
486+
repository has been created.
487+
Default is `null`.
488+
462489
#### [`template`](#repository-creation-configuration) Object Attributes
463490

464491
- **`owner`**: **_(Required `string`)_**

main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ resource "github_repository" "repository" {
118118
}
119119
}
120120

121+
dynamic "pages" {
122+
for_each = var.pages != null ? [true] : []
123+
124+
content {
125+
source {
126+
branch = var.pages.branch
127+
path = try(var.pages.path, "/")
128+
}
129+
cname = try(var.pages.cname, null)
130+
}
131+
}
132+
121133
lifecycle {
122134
ignore_changes = [
123135
auto_init,

test/unit-complete/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ module "repository" {
6666
(var.secret_name) = var.secret_text
6767
}
6868

69+
pages = {
70+
branch = "main"
71+
path = "/"
72+
}
73+
6974
webhooks = [{
7075
active = var.webhook_active
7176
events = var.webhook_events

0 commit comments

Comments
 (0)