Skip to content

Commit

Permalink
Merge pull request #67 from mineiros-io/soerenmartius/add-gh-pages
Browse files Browse the repository at this point in the history
Add GitHub Pages configuration block
  • Loading branch information
soerenmartius committed May 31, 2021
2 parents 8e4aff4 + 80c4d66 commit e341508
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 58 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.1]

### Added

- Add support for GitHub Pages configuration in repositories

## [0.9.0]

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

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

[unreleased]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.0...HEAD
[0.9.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.7.0...v0.8.0
[unreleased]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.1...HEAD
[0.9.1]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.9.0...v0.9.1

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

[0.9.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/mineiros-io/terraform-github-repository/compare/v0.5.1...v0.6.0
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ _Version `>= 0.8.0` of this module is compatible with `mineiros-io/team/github >
- [Secrets Configuration](#secrets-configuration)
- [`defaults` Object Attributes](#defaults-object-attributes)
- [`template` Object Attributes](#template-object-attributes)
- [`pages` Object Attributes](#pages-object-attributes)
- [`deploy_key` Object Attributes](#deploy_key-object-attributes)
- [`branch_protection` Object Attributes](#branch_protection-object-attributes)
- [`required_status_checks` Object Attributes](#required_status_checks-object-attributes)
Expand Down Expand Up @@ -128,6 +129,12 @@ See [variables.tf] and [examples/] for details and use-cases.
See below for a list of supported arguments.
Default is `{}` - use module defaults as described in the README.

- **[`pages`](#pages-object-attributes)**: _(Optional `object`)_

A object of settings to configure GitHub Pages in this repository.
See below for a list of supported arguments.
Default is `null`.

- **`allow_merge_commit`**: _(Optional `bool`)_

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

#### [`pages`](#pages-object-attributes) Object Attributes

This block is used for configuring GitHub Pages for the repository.
The following top-level arguments must be set to configure GitHub Pages for
the repository:

- **`branch`**: **_(Required `string`)_**

The repository branch used to publish the site's source files.

- **`path`**: **_(Optional `string`)_**

The repository directory from which the site publishes.

- **`cname`**: **_(Optional `string`)_**

The custom domain for the repository. This can only be set after the
repository has been created.
Default is `null`.

#### [`template`](#repository-creation-configuration) Object Attributes

- **`owner`**: **_(Required `string`)_**
Expand Down
12 changes: 12 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ resource "github_repository" "repository" {
}
}

dynamic "pages" {
for_each = var.pages != null ? [true] : []

content {
source {
branch = var.pages.branch
path = try(var.pages.path, "/")
}
cname = try(var.pages.cname, null)
}
}

lifecycle {
ignore_changes = [
auto_init,
Expand Down
5 changes: 5 additions & 0 deletions test/unit-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ module "repository" {
(var.secret_name) = var.secret_text
}

pages = {
branch = "main"
path = "/"
}

webhooks = [{
active = var.webhook_active
events = var.webhook_events
Expand Down

0 comments on commit e341508

Please sign in to comment.