Currently repository_file does not support automatic creation of branches. This means in order manage files via pull requests (rather than directly pushing to the branch ie. main), a branch would need created. This has impacts on terraform lifecycle post-creation ie. a pull request merging the branch and deleting it, in which the branch would attempt to be re-created causing a long-lived branch to exist in a repo.
After the change?
When the flag autocreate_branch is set true, if the branch does not already exist then it shall be created based on autocreate_branch_source_sha or autocreate_branch_source_branch which defaults to main during create, update or destroy. Given the branch could be ephemeral; on reads, if the branch does not exist then content shall be read from autocreate_branch_source_branch as it may been merged.
Pull request checklist
[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been reviewed and added / updated if needed (for bug fixes / features)
Resolves #2101
Before the change?
After the change?
autocreate_branch
is set true, if the branch does not already exist then it shall be created based onautocreate_branch_source_sha
orautocreate_branch_source_branch
which defaults to main during create, update or destroy. Given the branch could be ephemeral; on reads, if the branch does not exist then content shall be read from autocreate_branch_source_branch as it may been merged.Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!