|
1 | | -# Ona GCP Runner |
| 1 | +# Contributing |
2 | 2 |
|
3 | 3 | [](https://gitpod.io/#https://github.com/gitpod-io/terraform-google-ona-runner) |
4 | 4 |
|
5 | | -## Contributing |
6 | | - |
7 | | -1. Fork the repository |
8 | | -2. Create a feature branch |
9 | | -3. Make your changes |
10 | | -4. Test thoroughly |
11 | | -5. Submit a pull request |
12 | | - |
13 | | -## Quick Start |
14 | | - |
15 | | -1. **Clone and configure**: |
16 | | - ```bash |
17 | | - git clone <repository-url> |
18 | | - cd <repository-directory> |
19 | | - cp terraform.tfvars.example terraform.tfvars |
20 | | - ``` |
21 | | - |
22 | | -2. **Edit `terraform.tfvars`** with your values: |
23 | | - ```hcl |
24 | | - project_id = "your-gcp-project-id" |
25 | | - region = "us-central1" |
26 | | - zones = ["us-central1-a", "us-central1-b", "us-central1-c"] |
27 | | - runner_name = "my-ona-runner" |
28 | | - runner_id = "your-runner-id" # From Ona dashboard |
29 | | - runner_token = "your-runner-token" # From Ona dashboard |
30 | | - runner_domain = "ona.example.com" |
31 | | - vpc_name = "your-existing-vpc" # Existing VPC name |
32 | | - runner_subnet_name = "your-existing-subnet" # Existing subnet name |
33 | | - certificate_id = "projects/your-project/locations/global/certificates/your-cert" # Certificate Manager resource ID |
34 | | -
|
35 | | - # Optional: Proxy configuration |
36 | | - proxy_config = { |
37 | | - http_proxy = "http://proxy.example.com:8080" |
38 | | - https_proxy = "http://proxy.example.com:8080" |
39 | | - all_proxy = "http://proxy.example.com:8080" |
40 | | - no_proxy = "localhost,127.0.0.1,metadata.google.internal" |
41 | | - } |
42 | | -
|
43 | | - # Optional: Custom CA certificate (choose one method) |
44 | | - ca_certificate = { |
45 | | - file_path = "/path/to/ca-certificate.pem" # OR |
46 | | - content = "-----BEGIN CERTIFICATE-----\n..." |
47 | | - } |
48 | | -
|
49 | | - # Optional: Use pre-created service accounts |
50 | | - pre_created_service_accounts = { |
51 | | - runner = "my-runner@my-project.iam.gserviceaccount.com" |
52 | | - environment_vm = "my-env-vm@my-project.iam.gserviceaccount.com" |
53 | | - build_cache = "my-build-cache@my-project.iam.gserviceaccount.com" |
54 | | - secret_manager = "my-secrets@my-project.iam.gserviceaccount.com" |
55 | | - pubsub_processor = "my-pubsub@my-project.iam.gserviceaccount.com" |
56 | | - proxy_vm = "my-proxy-vm@my-project.iam.gserviceaccount.com" |
57 | | - } |
58 | | - ``` |
59 | | - |
60 | | -3. **Deploy**: |
61 | | - ```bash |
62 | | - terraform init |
63 | | - terraform plan |
64 | | - terraform apply |
65 | | - ``` |
| 5 | +This document provides guidelines for contributing to the Ona GCP Runner Terraform module. |
| 6 | + |
| 7 | +## Development Environment |
| 8 | + |
| 9 | +The easiest way to get started is to open this repository in [Ona](https://ona.com/) or run the included [dev container](.devcontainer/) locally with [VS Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) or any compatible IDE. The dev container comes pre-configured with all required tools. |
| 10 | + |
| 11 | +If you prefer a manual setup, install the following: |
| 12 | + |
| 13 | +- [Terraform](https://terraform.io/) >= 1.0 |
| 14 | +- [Google Cloud SDK](https://cloud.google.com/sdk/install) |
| 15 | +- [pre-commit](https://pre-commit.com/) |
| 16 | +- [terraform-docs](https://github.com/terraform-docs/terraform-docs) |
| 17 | + |
| 18 | +## File Structure |
| 19 | + |
| 20 | +| Path | Description | |
| 21 | +|---|---| |
| 22 | +| `*.tf` | Root module resources | |
| 23 | +| `variables.tf` | Input variables | |
| 24 | +| `outputs.tf` | Output values | |
| 25 | +| `versions.tf` | Provider and Terraform version constraints | |
| 26 | +| `modules/` | Submodules | |
| 27 | +| `examples/` | Example configurations | |
| 28 | +| `docs/` | Additional documentation | |
| 29 | +| `files/` | Template files used by resources | |
| 30 | + |
| 31 | +## Making Changes |
| 32 | + |
| 33 | +1. Fork the repository and create a feature branch. |
| 34 | +2. Make your changes, following the conventions below. |
| 35 | +3. Run linting and formatting checks. |
| 36 | +4. Submit a pull request against `main`. |
| 37 | + |
| 38 | +### Linting and Formatting |
| 39 | + |
| 40 | +This repository uses [pre-commit](https://pre-commit.com/) hooks for `terraform fmt`, `terraform-docs`, `shellcheck`, and general file hygiene. Install the hooks once after cloning: |
| 41 | + |
| 42 | +```bash |
| 43 | +pre-commit install |
| 44 | +``` |
| 45 | + |
| 46 | +To run all checks manually: |
| 47 | + |
| 48 | +```bash |
| 49 | +pre-commit run --all-files |
| 50 | +``` |
| 51 | + |
| 52 | +### Generating Documentation |
| 53 | + |
| 54 | +Input and output tables in README files are generated automatically by `terraform-docs` via pre-commit. If you change `variables.tf` or `outputs.tf`, the tables will be updated on your next commit. You can also regenerate them manually: |
| 55 | + |
| 56 | +```bash |
| 57 | +pre-commit run terraform_docs --all-files |
| 58 | +``` |
| 59 | + |
| 60 | +## License |
| 61 | + |
| 62 | +By contributing, you agree that your contributions will be licensed under the [Mozilla Public License 2.0](LICENSE). |
0 commit comments