|
| 1 | +# Contributing to the Gitea Terraform Provider |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Gitea Terraform Provider! This document outlines the basic process to contribute effectively. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. **Fork the repository** on Gitea. |
| 8 | +2. **Clone your fork** locally. |
| 9 | +3. **Create a branch** for your changes. |
| 10 | + |
| 11 | + |
| 12 | +See also [Hashicorp's Terraform Provider tutorial](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-provider) |
| 13 | + |
| 14 | +## Testing your changes |
| 15 | + |
| 16 | +### Running a local Gitea instance |
| 17 | + |
| 18 | +```bash |
| 19 | +docker run -p 3000:3000 gitea/gitea:latest-rootless |
| 20 | +``` |
| 21 | + |
| 22 | +Visit http://localhost:3000 and go through the setup: |
| 23 | +1. Url: http://localhost:3000 |
| 24 | +2. Username: gitea_admin |
| 25 | +3. Password: gitea_admin |
| 26 | + |
| 27 | + |
| 28 | +### Using the local version of the Provider |
| 29 | +This involves 2 main steps: |
| 30 | +- `go install .` to install the provider binary. |
| 31 | +- Use .terraformrc file to point to that binary instead of the terraform registry. |
| 32 | + |
| 33 | +See Terraform docs on [development overrides for provider developers](https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers) |
| 34 | + |
| 35 | +Also see [this tutorial section](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-provider#prepare-terraform-for-local-provider-install) for a bit more context. |
| 36 | + |
| 37 | +Example linux `~/.terraformrc` file: |
| 38 | +``` |
| 39 | +provider_installation { |
| 40 | +
|
| 41 | + dev_overrides { |
| 42 | + "go-gitea/gitea" = "/home/<username>/go/bin" |
| 43 | + } |
| 44 | +
|
| 45 | + # For all other providers, install them directly from their origin provider |
| 46 | + # registries as normal. If you omit this, Terraform will _only_ use |
| 47 | + # the dev_overrides block, and so no other providers will be available. |
| 48 | + direct {} |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### Applying the example module |
| 53 | + |
| 54 | +With the local provider and the local Gitea instance set up properly as per above chapters, the example module can be applied: |
| 55 | + |
| 56 | +- navigate into `examples/` |
| 57 | +- run terraform commands |
| 58 | + |
| 59 | + |
| 60 | + |
0 commit comments