Skip to content

Instantly share code, notes, and snippets.

@benmatselby

benmatselby/provider.tf

Last active Apr 11, 2021
Embed
What would you like to do?
Terraform GitHub Repo Admin
provider "github" {
token = var.github_token
owner = var.github_org
}
resource "github_repository" "repos" {
for_each = var.github_repos
name = each.value["name"]
description = each.value["description"]
archived = each.value["archived"]
// Settings
visibility = "private"
has_downloads = true
has_issues = true
has_wiki = true
vulnerability_alerts = true
// Merge settings
allow_merge_commit = true
allow_squash_merge = false
allow_rebase_merge = false
delete_branch_on_merge = true
// Topics
topics = each.value["topics"]
}
variable "github_token" {
type = string
description = "The access token to GitHub"
}
variable "github_org" {
type = string
description = "The GitHub organisation"
default = "benmatselby"
}
variable "github_repos" {
type = map
description = "All our repos we want to manage using Terraform"
default = {
tfgithubadmin = {
"name" : "tf-github-admin",
"description" : "The Terraform configuration to manage GitHub repos",
"topics" : ["terraform", "automation"],
"archived": false
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment