Skip to content

Commit

Permalink
add option to restrict deployments, require protected branch source
Browse files Browse the repository at this point in the history
  • Loading branch information
figadore committed Dec 21, 2021
1 parent eb83dea commit 24f653a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/publish-terraform-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
id: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
DEFAULT_BUMP: minor
WITH_V: false
DRY_RUN: true
- name: List Release
Expand Down
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ resource "github_repository_environment" "repo_apply_environment" {
teams = var.terraform_apply_reviewers
users = []
}
deployment_branch_policy {
protected_branches = var.require_protected_branches
#https://github.com/integrations/terraform-provider-github/issues/922#issuecomment-998957627
custom_branch_policies = false
}
}

# Store the domain's project id for easier access during github actions workflows
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ variable "workload_identity_provider" {
description = "GCP Workload Identity provider id for setting repo environment secrets for gcloud setup step"
type = string
}

variable "require_protected_branches" {
description = "Whether to restrict the apply environment to deploying from protected branches. Recommended to set to true for PRD"
type = bool
default = false
}

0 comments on commit 24f653a

Please sign in to comment.