Skip to content

Commit

Permalink
PLT-1067 - Add support for workflows build type in github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Engerim committed Jan 3, 2025
1 parent c7d4fdd commit 6c3988c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ resource "github_repository" "this" {
dynamic "pages" {
for_each = var.pages != null ? { this = var.pages } : {}
content {
build_type = pages.value["build_type"]
dynamic "source" {
for_each = { this = pages.value["source"] }
for_each = pages.value["build_type"] == "legacy" ? { this = pages.value["source"] } : {}
content {
branch = source.value["branch"]
path = source.value["path"]
Expand Down
11 changes: 8 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,17 @@ variable "collaborators" {

variable "pages" {
type = object({
source = object({
build_type = optional(string, "legacy")
source = optional(object({
branch = string
path = string
})
}))
})
default = null
default = null
validation {
condition = var.pages == null ? true : var.pages.build_type == "legacy" ? try(var.pages.source.branch, "") != "" && try(var.pages.source.path, "") != "" : true
error_message = "When build type is legacy for pages source branch and path are required."
}
description = "The repository's GitHub Pages configuration."
}

Expand Down

0 comments on commit 6c3988c

Please sign in to comment.