Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Terraform module (modules/gh-files-set) intended to manage a set of files in GitHub repositories (issue #969), and wires it into the repo’s release automation configuration.
Changes:
- Added new
gh-files-setTerraform module usinggithub_repository_fileto manage multiple files via a singleconfigobject. - Added module docs scaffolding (
terraform-docsconfig + header/footer content) and a basic example YAML input. - Registered the new module package in
release-please-config.json.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| release-please-config.json | Registers modules/gh-files-set as a release-please package. |
| modules/gh-files-set/main.tf | Implements managed vs “user-managed” GitHub repository files. |
| modules/gh-files-set/variables.tf | Defines the config input schema + validations. |
| modules/gh-files-set/outputs.tf | Exposes a list of user-managed file paths. |
| modules/gh-files-set/versions.tf | Declares GitHub provider requirement (missing required Terraform version constraint). |
| modules/gh-files-set/docs/header.md | Module overview and usage snippet for terraform-docs injection. |
| modules/gh-files-set/docs/footer.md | Footer content for terraform-docs injection (currently includes scaffolding/code fences). |
| modules/gh-files-set/README.md | Generated/injected docs (currently out of sync with module interface/resources/outputs). |
| modules/gh-files-set/.terraform-docs.yml | terraform-docs configuration for README generation. |
| modules/gh-files-set/_examples/basic/files.yaml | Example input YAML (currently does not match the module input schema). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…p/tfm into feat/969-poc-gh-files-set
| # User-managed files — provision once + ignore content drift | ||
| resource "github_repository_file" "user_managed" { | ||
| for_each = { | ||
| for f in var.config.files : "${f.repository}/${f.file}/${f.branch}" => f | ||
| if f.userManaged | ||
| } | ||
|
|
||
| repository = data.github_repository.this.name | ||
| branch = each.value.branch | ||
| file = each.value.file | ||
| content = each.value.content | ||
| commit_message = each.value.commitMessage | ||
| overwrite_on_create = each.value.overwriteOnCreate | ||
|
|
||
| lifecycle { | ||
| ignore_changes = [content] | ||
| } |
There was a problem hiding this comment.
@copilot how we could avoid user-managed files to be destroyed on terraform destroy, but without blocking the destroy process, that is, the terraform state should be destroyed without altering the file's contents, please implement it if you see a solution.
Co-authored-by: Javier Gómez Rodríguez <javier.gomez@prefapp.es>
|
@alambike this problem is resolved by removing the files with a The solution is working and has been tested. |
Besides the copilot solution seems to fail: https://github.com/jvazquez-prefapp/state-github/runs/68045393156?check_suite_focus=true |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| files = list(object({ | ||
| branch = string | ||
| commitMessage = string | ||
| content = string | ||
| file = string | ||
| overwriteOnCreate = optional(bool, true) | ||
| userManaged = optional(bool, false) | ||
| })) |
There was a problem hiding this comment.
The nested config.files object introduces camelCase attributes (commitMessage, overwriteOnCreate, userManaged). The rest of the repo’s Terraform module interfaces consistently use snake_case for variable and object attribute names (e.g., modules/aws-backup/variables.tf). Consider renaming these to snake_case for consistency (and to match github_repository_file arguments), or add a normalization layer if external tools require camelCase.
solves #969