-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathgithub_file.tf
45 lines (40 loc) · 1.56 KB
/
github_file.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# vim:ts=2:sts=2:sw=2:et
#
# Author: Hari Sekhon
# Date: 2022-03-21 16:34:40 +0000 (Mon, 21 Mar 2022)
#
# https://github.com/HariSekhon/Terraform
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# G i t H u b F i l e
# ============================================================================ #
# Manage files in one or more GitHub repos, such as CodeOwners, .gitignore, or GitHub Actions workflows
# https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_file#commit_email
resource "github_repository_file" "MYFILE" {
repository = github_repository.foo.name
branch = "main" # or "master"
file = ".gitignore"
#content = "**/*.tfstate"
# ensure there is a newline at end of file via EOT style so people with IDEs or pre-commit hooks aren't changing the file during PRs
content = <<EOF
# Managed by Terraform - DO NOT EDIT
PUT YOUR CONTENT HERE IN TERRAFORM
EOF
# requires both or neither - uses the account owning the github token as the author if omitted
#commit_author = "Terraform"
#commit_email = "[email protected]"
#commit_message = "Managed by Terraform"
overwrite_on_create = false
lifecycle {
ignore_changes = [
commit_message,
overwrite_on_create
]
}
}