Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[documentation]: update contributing: move terraformrc section to reb… #1283

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 48 additions & 51 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
Developing the Provider
---------------------------
# Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
Testing Your Changes Locally
----------------------------

### 1. Rebuilding the Provider
1.1 If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.

To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

```sh
$ make build
...
$ $GOPATH/bin/terraform-provider-digitalocean
$ ls -la $GOPATH/bin/terraform-provider-digitalocean
...
```

### Running unit tests
In order to test the provider, you can simply run `make test`.

```sh
$ make test
```

### Running Acceptance Tests

Please be aware that **running ALL acceptance tests will take a significant amount of time and could be expensive**, as they interact with your **real DigitalOcean account**. For this reason, it is highly recommended to run only one acceptance test at a time to minimize both time and cost.

- It is preferable to run one acceptance test at a time.
In order to run a specific acceptance test, use the `TESTARGS` environment variable. For example, the following command will run `TestAccDigitalOceanDomain_Basic` acceptance test only:

```sh
$ make testacc TESTARGS='-run=TestAccDigitalOceanDomain_Basic'
```
Remember to rebuild the provider with `make build` to apply any new changes.

- All acceptance tests for a specific package can be run by setting the `PKG_NAME` environment variable. For example:

```sh
$ make testacc PKG_NAME=digitalocean/account
```

- In order to run the full suite of acceptance tests, run `make testacc`.

**Note:** Acceptance tests create real resources, and often cost money to run.

```sh
$ make testacc
```

### To check changes made locally
In order to check changes you made locally to the provider, you can use the binary you just compiled by adding the following
1.2 In order to check changes you made locally to the provider, you can use the binary you just compiled by adding the following
to your `~/.terraformrc` file. This is valid for Terraform 0.14+. Please see
[Terraform's documentation](https://www.terraform.io/docs/cli/config/config-file.html#development-overrides-for-provider-developers)
for more details.
Expand All @@ -68,20 +40,6 @@ provider_installation {
}
```

For information about writing acceptance tests, see the main Terraform [contributing guide](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#writing-acceptance-tests).

Testing Your Changes Locally
----------------------------

### 1. Rebuilding the Provider
To apply your changes, you need to rebuild the provider:

Run the following command to rebuild the provider from the root directory of the project:

```console
make build
```

### 2. Creating a Sample Terraform Configuration
2.1 From the root of the project, create a directory for your Terraform configuration:

Expand Down Expand Up @@ -159,8 +117,47 @@ export TF_LOG=TRACE

After setting the log level, you can run `terraform plan` or `terraform apply` again to see more detailed output.

Provider Automation Tests
--------------------
### Running unit tests
In order to test the provider, you can simply run `make test`.

```sh
$ make test
```

### Running Acceptance Tests

Rebuild the provider before running acceptance tests.

Please be aware that **running ALL acceptance tests will take a significant amount of time and could be expensive**, as they interact with your **real DigitalOcean account**. For this reason, it is highly recommended to run only one acceptance test at a time to minimize both time and cost.

- It is preferable to run one acceptance test at a time.
In order to run a specific acceptance test, use the `TESTARGS` environment variable. For example, the following command will run `TestAccDigitalOceanDomain_Basic` acceptance test only:

```sh
$ make testacc TESTARGS='-run=TestAccDigitalOceanDomain_Basic'
```

- All acceptance tests for a specific package can be run by setting the `PKG_NAME` environment variable. For example:

```sh
$ make testacc PKG_NAME=digitalocean/account
```

- In order to run the full suite of acceptance tests, run `make testacc`.

**Note:** Acceptance tests create real resources, and often cost money to run.

```sh
$ make testacc
```

For information about writing acceptance tests, see the main Terraform [contributing guide](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#writing-acceptance-tests).

Releasing the Provider
----------------------
The dedicated DigitalOcean team is responsible for releasing the provider.

To release the provider:

Expand Down