diff --git a/github_files.tf b/github_files.tf index cafffac..bcab381 100644 --- a/github_files.tf +++ b/github_files.tf @@ -1,3 +1,8 @@ +# Retrieve information about the currently authenticated user. +data "github_user" "current" { + username = "" +} + locals { # Process files only if commit signing is not required or if explicitly allowed should_manage_files = ! try(local.github_repo.require_signed_commits, false) || var.allow_unsigned_files @@ -12,8 +17,8 @@ resource "github_repository_file" "codeowners" { file = "CODEOWNERS" content = templatefile("${path.module}/templates/CODEOWNERS", { codeowners = local.codeowners }) commit_message = "Update CODEOWNERS file" - commit_author = var.commit_author - commit_email = var.commit_email + commit_author = data.github_user.current.name + commit_email = data.github_user.current.email overwrite_on_create = true depends_on = [ github_repository.repo @@ -63,8 +68,8 @@ resource "github_repository_file" "extra_files" { file = each.value.path content = each.value.content commit_message = "Update ${each.value.path}" - commit_author = var.commit_author - commit_email = var.commit_email + commit_author = data.github_user.current.name + commit_email = data.github_user.current.email overwrite_on_create = true depends_on = [ github_repository.repo @@ -85,8 +90,8 @@ resource "github_repository_file" "managed_extra_files" { file = each.value.path content = each.value.content commit_message = "Update ${each.value.path}" - commit_author = var.commit_author - commit_email = var.commit_email + commit_author = data.github_user.current.name + commit_email = data.github_user.current.email overwrite_on_create = true depends_on = [ github_repository.repo diff --git a/variables.tf b/variables.tf index e02e81e..d563ca9 100644 --- a/variables.tf +++ b/variables.tf @@ -392,12 +392,6 @@ variable "commit_author" { default = "Terraform" } -variable "commit_email" { - description = "The email to use for file commits" - type = string - default = "terraform@roknsound.com" -} - variable "require_signed_commits" { description = "Whether to require signed commits for the default branch" type = bool