From 07e1ac97963b74e2b4b3052f4a900ab8c4aae65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Miguel=20Cust=C3=B3dio?= Date: Fri, 6 Sep 2019 10:32:31 +0100 Subject: [PATCH] Update 'README.md'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bruno Miguel Custódio --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 230e884..5c76fb8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,15 @@ -# terraform-provider-github-file +# terraform-provider-githubfile A Terraform provider for managing files in GitHub repositories. +## Use-cases + +A few possible use-cases for `terraform-provider-githubfile` are: + +* Adding a `LICENSE` file to a number of repositories. +* Making sure repositories across an organisation have consistent issue/pull request templates. +* Configuring a tool such as [`golangci-lint`](https://github.com/golangci/golangci-lint) or [`pre-commit`](https://pre-commit.com/) uniformly across a number of repositories + ## Installation Download the relevant binary from [releases](https://github.com/form3tech-oss/terraform-provider-github-file/releases) and copy it to `$HOME/.terraform.d/plugins/`. @@ -10,11 +18,13 @@ Download the relevant binary from [releases](https://github.com/form3tech-oss/te The following provider block variables are available for configuration: -- `github_email`: The email address to use for commit messages. If a GPG key is provided, this must match the one which the key corresponds to. -- `github_token`: A GitHub authorisation token with `repo` permissions and having `admin` access to the target repositories. -- `github_username`: The username to use for commit messages. -- `gpg_passphrase` The passphrase associated with the provided `gpg_secret_key` (see below). -- `gpg_secret_key` The GPG secret key to be use for commit signing. +| Name | Description | +| ---- | ----------- | +| `github_email` | The email address to use for commit messages.
If a GPG key is provided, this must match the one which the key corresponds to. | +| `github_token` | A GitHub authorisation token with `repo` permissions and having `admin` access to the target repositories. | +| `github_username` | The username to use for commit messages. | +| `gpg_passphrase` | The passphrase associated with the provided `gpg_secret_key` (see below). | +| `gpg_secret_key` | The GPG secret key to be use for commit signing.
If left empty, commits will not be signed. | Alternatively, these values can be read from environment variables. @@ -22,24 +32,48 @@ Alternatively, these values can be read from environment variables. ### `githubfile_file` -The `githubfile_file` resource represents a file in a given branch of a GitHub repository: +The `githubfile_file` resource represents a file in a given branch of a GitHub repository. + +#### Attributes + +| Name | Description | +| ---- | ----------- | +| `repository_owner` | The owner of the repository. | +| `repository_name` | The name of the repository. | +| `branch` | The branch in which to create/update the file
Leaving this empty will cause the file to be created/updated in the default branch. | +| `path` | The path to the file being created/updated. | +| `contents` | The contents of the file. | + +#### Example ```hcl -resource "githubfile_file" "form3tech_oss_terraform_provider_github_file_test_readme_md" { +resource "githubfile_file" "form3tech_oss_terraform_provider_githubfile_issue_template" { repository_owner = "form3tech-oss" - repository_name = "terraform-provider-github-file-test" + repository_name = "terraform-provider-githubfile" branch = "" - path = "README.md" + path = ".github/ISSUE_TEMPLATE.md" contents = < EOF } ``` -Creating the resource above will result in the `README.md` file being created on the _default branch_ of the `form3tech-oss/terraform-provider-github-file-test` repository with the following contents: +Creating the resource above will result in the `.github/ISSUE_TEMPLATE.md` file being created/updated on the default branch of the `form3tech-oss/terraform-provider-githubfile` repository with the following contents: ```markdown -# terraform-provider-github-file-test -Test repository for 'form3tech-oss/terraform-provider-github-file'. +# Issue Type + +- [ ] Bug report. +- [ ] Suggestion. + +# Description + + ```