|
| 1 | +# Contributing to Temporal Cloud Terraform Provider |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Temporal Cloud Terraform Provider! This document provides guidelines for contributions, including setting up your development environment, contributing to the codebase, and expectations for community contributions. |
| 4 | + |
| 5 | +## Encouraging Contributions |
| 6 | + |
| 7 | +We actively encourage contributions in the form of issues and pull requests (PRs). Whether you've found a bug, want to request a feature, or contribute new functionality, we welcome all participation. Your input helps improve the quality and usability of the Temporal Cloud Terraform Provider for everyone. |
| 8 | + |
| 9 | +For those looking to get started for the first time pls see the issues labeled [good first issue](https://github.com/temporalio/terraform-provider-temporalcloud/labels/good%20first%20issue) |
| 10 | + |
| 11 | +### Opening Issues |
| 12 | + |
| 13 | +If you encounter a bug, have a feature request, or need clarification on some part of the codebase, please open an issue. When doing so, ensure that: |
| 14 | + |
| 15 | +- You provide a clear description of the issue. |
| 16 | +- Include any relevant logs, error messages, or reproduction steps (if applicable). |
| 17 | +- If possible, offer suggestions on how the problem might be solved. |
| 18 | +- Be sure not to post any company sensitive data in your issue. |
| 19 | + |
| 20 | +### Submitting Pull Requests (PRs) |
| 21 | + |
| 22 | +We welcome all PRs. Before submitting a PR, please ensure that: |
| 23 | + |
| 24 | +- Your code changes are well-tested. |
| 25 | +- The PR includes a clear description of what you're addressing and why. |
| 26 | +- If the PR introduces new functionality, appropriate tests are added. |
| 27 | + |
| 28 | +Feel free to submit a draft PR early if you need feedback or assistance during the development process. This can help identify potential improvements or issues early on. |
| 29 | + |
| 30 | +Note: When you submit your first PR, you will be asked to sign the [Temporal Contributor License Agreement (CLA)](https://gist.github.com/samarabbas/7dcd41eb1d847e12263cc961ccfdb197) before we merge your PR. |
| 31 | + |
| 32 | +## Issues and Pull Requests Lifecycle |
| 33 | + |
| 34 | +- **Issues**: This is an open source project. Issues can be resolved by any community member. The maintainers of this project do triage issues regularly to ensure the issue is clear and tagged appropriately. If more information is needed, we will ask for further clarification. We encourage discussion to clarify the problem or refine solutions. |
| 35 | + |
| 36 | +- **Pull Requests**: Once a PR is submitted, it will be reviewed by the maintainers. Feedback will be provided, and the contributor may be asked to make changes. Once all feedback is addressed and the PR passes the necessary tests, it will be merged. Please note that complex changes or large PRs may take longer to review. |
| 37 | + |
| 38 | +## Expectations for Reviews and Issue Triage |
| 39 | + |
| 40 | +While we strive to review issues/PRs and merge contributions as quickly as possible, we operate on a **best-effort basis**. There are no guarantees on review times, and no service level agreements (SLAs) are provided. We appreciate your patience and understanding as maintainers work through the queue of issues and pull requests. |
| 41 | + |
| 42 | +## Prerequisites |
| 43 | + |
| 44 | +Before contributing, please ensure you have the following prerequisites installed: |
| 45 | + |
| 46 | +- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0 |
| 47 | +- [Go](https://golang.org/doc/install) >= 1.19 |
| 48 | +- [Temporal Go SDK](https://github.com/temporalio/sdk-go) >= 1.26.0 |
| 49 | +- [Docker](https://docs.docker.com/get-docker/), for running acceptance tests |
| 50 | + |
| 51 | +## Development Setup |
| 52 | + |
| 53 | +### Cloning the repository |
| 54 | + |
| 55 | +To begin working on the provider, clone the repository into your development environment: |
| 56 | + |
| 57 | +```sh |
| 58 | +git clone https://github.com/temporalio/terraform-provider-temporalcloud.git |
| 59 | +cd terraform-provider-temporalcloud |
| 60 | +``` |
| 61 | + |
| 62 | +### Building the provider |
| 63 | + |
| 64 | +To build the provider, use the Go `install` command: |
| 65 | + |
| 66 | +```sh |
| 67 | +go install |
| 68 | +``` |
| 69 | + |
| 70 | +This will install the provider binary in your `$GOPATH/bin` directory. |
| 71 | + |
| 72 | +### Running Tests |
| 73 | + |
| 74 | +#### Unit Tests |
| 75 | + |
| 76 | +Unit tests should be executed frequently to ensure the quality of your contributions. Run the following command to execute the tests: |
| 77 | + |
| 78 | +```sh |
| 79 | +make test |
| 80 | +``` |
| 81 | + |
| 82 | +#### Acceptance Tests |
| 83 | + |
| 84 | +Running acceptance tests locally will create real resources in Temporal Cloud, and running them may incur costs. Ensure you have a Temporal Cloud API key configured as described in the [README](https://registry.terraform.io/providers/temporalio/temporalcloud/latest/docs) before running these tests: |
| 85 | + |
| 86 | +```sh |
| 87 | +make testacc |
| 88 | +``` |
| 89 | + |
| 90 | +#### Testing with Terraform |
| 91 | + |
| 92 | +To test your code locally with Terraform, build the provider locally: |
| 93 | + |
| 94 | +```sh |
| 95 | +go build -o terraform-provider-temporalcloud |
| 96 | +mkdir -p ~/.terraform.d/plugins/temporal.io/provider-temporalcloud/temporalcloud/1.0.0/darwin_arm64/ |
| 97 | +mv terraform-provider-temporalcloud ~/.terraform.d/plugins/temporal.io/provider-temporalcloud/temporalcloud/1.0.0/darwin_arm64/ |
| 98 | +``` |
| 99 | + |
| 100 | +In your Terraform configuration, specify the local provider binary: |
| 101 | + |
| 102 | +```terraform |
| 103 | +provider "temporalcloud" { |
| 104 | + api_key = "<API_KEY>" |
| 105 | +} |
| 106 | +
|
| 107 | +terraform { |
| 108 | + required_providers { |
| 109 | + temporalcloud = { |
| 110 | + version = "~> 1.0.0" |
| 111 | + source = "temporal.io/provider-temporalcloud/temporalcloud" |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +## Documentation |
| 118 | + |
| 119 | +Documentation for resources and data sources is defined in the code (see `MarkdownDescription`) and generated programmatically. To update the documentation: |
| 120 | + |
| 121 | +1. Make code changes. |
| 122 | +2. Run the following commands to format the code and generate documentation: |
| 123 | + |
| 124 | +```sh |
| 125 | +gofmt -s -w . |
| 126 | +go generate ./... |
| 127 | +``` |
| 128 | + |
| 129 | +## Adding Dependencies |
| 130 | + |
| 131 | +This provider uses Go modules for dependency management. To add a new dependency, run the following commands: |
| 132 | + |
| 133 | +```sh |
| 134 | +go get github.com/author/dependency |
| 135 | +go mod tidy |
| 136 | +``` |
| 137 | + |
| 138 | +Make sure to commit the changes to both `go.mod` and `go.sum`. |
| 139 | + |
| 140 | +## Code Style |
| 141 | + |
| 142 | +All code contributions should follow the established code style. Use `gofmt` to automatically format your code: |
| 143 | + |
| 144 | +```sh |
| 145 | +gofmt -s -w . |
| 146 | +``` |
| 147 | + |
| 148 | +## Commit Messages and Pull Requests |
| 149 | + |
| 150 | +We follow the [Chris Beams](https://chris.beams.io/posts/git-commit/) style for writing commit messages. Please ensure: |
| 151 | + |
| 152 | +- Commit message titles are capitalized and concise. |
| 153 | +- Pull request titles follow the same guidelines and avoid generic phrases like "bug fixes." |
0 commit comments