Skip to content

Commit

Permalink
Update 'README.md'.
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
  • Loading branch information
bmcustodio committed Sep 6, 2019
1 parent f25e395 commit 07e1ac9
Showing 1 changed file with 49 additions and 15 deletions.
64 changes: 49 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/`.
Expand All @@ -10,36 +18,62 @@ 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.<br>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.<br>If left empty, commits will not be signed. |

Alternatively, these values can be read from environment variables.

## Resources

### `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<br>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
# terraform-provider-github-file-test
Test repository for 'form3tech-oss/terraform-provider-github-file'.
# Issue Type
- [ ] Bug report.
- [ ] Suggestion.
# Description
<!-- Please provide a description of the issue. -->
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

<!-- Please provide a description of the issue. -->
```

0 comments on commit 07e1ac9

Please sign in to comment.