Skip to content

Commit

Permalink
all the remaining variables + branch_protection config
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Sep 23, 2023
1 parent 3184e6b commit e55ca15
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 21 deletions.
27 changes: 21 additions & 6 deletions repository/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ provider "github" {
}

resource github_repository this {
name = var.repository
description = var.description
vulnerability_alerts = true
has_wiki = false
name = var.name
description = var.description
vulnerability_alerts = true
homepage_url = var.homepage_url
visibility = var.private ? "private" : "public"
has_issues = var.has_issues
has_discussions = var.has_discussions
has_projects = var.has_projects
has_wiki = var.has_wiki
has_downloads = false
allow_merge_commit = false
allow_squash_merge = true
allow_rebase_merge = false
allow_auto_merge = false
delete_branch_on_merge = true
auto_init = true
license_template = var.license_template
allow_update_branch = true
topics = var.topics
dynamic "pages" {
for_each = var.pages_url != null ? [1] : []
content {
Expand All @@ -39,7 +54,7 @@ resource github_branch_protection main {
force_push_bypassers = []
lock_branch = false
push_restrictions = []
require_conversation_resolution = false
require_conversation_resolution = true
require_signed_commits = false
required_linear_history = false
required_linear_history = true
}
55 changes: 40 additions & 15 deletions repository/variables.tf
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
variable "owner" {
type = string
description = "GitHub user/organization containing the repository"
type = string
}

variable "repository" {
type = string
variable "name" {
description = "GitHub repository name"
type = string
}

variable "description" {
type = string
description = "Repository description"
type = string
}

variable "private" {
type = bool
description = "Is this a private repository (public by default)"
default = false
type = bool
default = false
}

variable "homepage_url" {
type = string
description = "URL of a page describing the project."
default = null
description = "URL of a page describing the project"
type = string
default = null
}

variable "pages_url" {
Expand All @@ -31,13 +31,38 @@ variable "pages_url" {
default = null
}

variable "has_downloads" {
type = bool
default = false
variable "has_issues" {
description = "Set to `true` to enable the GitHub Issues features on the repository"
type = bool
default = false
}

variable "has_issues" {
type = bool
default = false
variable "has_discussions" {
description = "Set to `true` to enable GitHub Discussions on the repository"
type = bool
default = false
}

variable "has_projects" {
description = " Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub documentation when in an organization that has disabled repository projects it will default to false and will otherwise default to true. If you specify true when it has been disabled it will return an error."
type = bool
default = false
}

variable "has_wiki" {
description = " Set to true to enable the GitHub Wiki features on the repository."
type = bool
default = false
}

variable "license_template" {
description = "Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, \"mit\" or \"mpl-2.0\"."
type = string
default = null
}

variable "topics" {
description = "The list of topics of the repository"
type = list(string)
default = null
}

0 comments on commit e55ca15

Please sign in to comment.