diff --git a/github_files.tf b/github_files.tf index f9abb76..a0335c1 100644 --- a/github_files.tf +++ b/github_files.tf @@ -54,4 +54,16 @@ resource "github_repository_file" "extra_files" { } } - +resource "github_repository_file" "managed_extra_files" { + for_each = tomap({ for file in var.managed_extra_files : "${element(split("/", file.path), length(split("/", file.path)) - 1)}" => file }) + repository = github_repository.repo.name + branch = var.github_default_branch + file = each.value.path + content = each.value.content + overwrite_on_create = true + lifecycle { + ignore_changes = [ + branch + ] + } +} diff --git a/variables.tf b/variables.tf index 02cf9f4..6a2f959 100644 --- a/variables.tf +++ b/variables.tf @@ -146,6 +146,14 @@ variable "extra_files" { description = "Extra Files" } +variable "managed_extra_files" { + type = list(object({ + path = string, + content = string + })) + default = [] + description = "Managed Extra Files. Changes to Content will be updated" +} variable "pull_request_bypassers" { default = []