Commit b3d4ef6c authored by David McKay's avatar David McKay

feat: add branch protection through Terraform

parent 2df21790
name: Terraform name: Repository Configuration with Terraform
on: on:
push: push:
......
...@@ -8,8 +8,8 @@ provider "google" { ...@@ -8,8 +8,8 @@ provider "google" {
} }
provider "github" { provider "github" {
token = var.github_token
organization = "influxdata" organization = "influxdata"
anonymous = false
} }
terraform { terraform {
...@@ -18,7 +18,3 @@ terraform { ...@@ -18,7 +18,3 @@ terraform {
prefix = "github.com/helm-charts" prefix = "github.com/helm-charts"
} }
} }
variable "github_token" {
type = string
}
...@@ -3,7 +3,8 @@ resource "github_repository" "helm_charts" { ...@@ -3,7 +3,8 @@ resource "github_repository" "helm_charts" {
description = "Official Helm Chart Repository for InfluxData Applications" description = "Official Helm Chart Repository for InfluxData Applications"
allow_merge_commit = false allow_merge_commit = false
allow_rebase_merge = false allow_squash_merge = false
allow_rebase_merge = true
has_downloads = true has_downloads = true
has_issues = true has_issues = true
...@@ -18,6 +19,25 @@ resource "github_repository" "helm_charts" { ...@@ -18,6 +19,25 @@ resource "github_repository" "helm_charts" {
private = false private = false
} }
resource "github_branch_protection" "helm_charts_master" {
repository = "${github_repository.helm_charts.name}"
branch = "master"
enforce_admins = true
required_status_checks {
strict = true
}
required_pull_request_reviews {
dismiss_stale_reviews = true
require_code_owner_reviews = true
required_approving_review_count = 2
}
restrictions {
}
}
variable "colour_dark_blue" { variable "colour_dark_blue" {
type = string type = string
default = "779ecb" default = "779ecb"
...@@ -34,4 +54,3 @@ resource "github_issue_label" "types" { ...@@ -34,4 +54,3 @@ resource "github_issue_label" "types" {
repository = github_repository.helm_charts.name repository = github_repository.helm_charts.name
color = var.colour_dark_blue color = var.colour_dark_blue
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment