Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 2.55 KB

CONTRIBUTING.md

File metadata and controls

100 lines (67 loc) · 2.55 KB

Contributing to DNSimple/terraform-provider

Getting started

1. Clone the repository

Clone the repository and move into it:

git clone [email protected]:dnsimple/terraform-provider-dnsimple.git
cd terraform-provider-dnsimple

2. Build and test

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.18+ is required). You'll also need to correctly setup a 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.

$ make build
...
$ $GOPATH/bin/terraform-provider-dnsimple
...

Testing

make test

You can also run the integration tests like:

DNSIMPLE_ACCOUNT=12345 DNSIMPLE_TOKEN="adf23cf" DNSIMPLE_DOMAIN=example.com DNSIMPLE_SANDBOX=true make testacc

Testing the let's encrypt resource and the certificate data-source

Our sandbox environment does not allow purchasing or issue certificates. For that reason, if you want to test the resource_dnsimple_lets_encrypt_certificate you will have to run the tests in production (setting DNSIMPLE_SANDBOX=false in the shell).

You will have to set the following env variables in your shell:

  • DNSIMPLE_CERTIFICATE_NAME the name for which to request the certificate i.e. www
  • DNSIMPLE_CERTIFICATE_ID the certificate ID used in the datasource test

Sideload the plugin

Sideload the plugin

make install
# Replace `darwin_arm64` with your arch. GOBIN should be where the Go built binary is installed to.
ln -s "$GOBIN/terraform-provider-dnsimple" "$HOME/.terraform.d/plugins/terraform.local/dnsimple/dnsimple/0.1.0/darwin_arm64/."

Use this as the provider configuration:

dnsimple = {
  source  = "terraform.local/dnsimple/dnsimple"
  version = "0.1.0"
}

You can use the ./example/simple.tf config to test the provider.

cd example
terraform init && terraform apply --auto-approve

Releasing

The following instructions uses $VERSION as a placeholder, where $VERSION is a MAJOR.MINOR.BUGFIX release such as 1.2.0.

  1. Run the test suite and ensure all the tests pass.

  2. Finalize the ## main section in CHANGELOG.md assigning the version.

  3. Commit and push the changes

    git commit -a -m "Release $VERSION"
    git push origin main
  4. Wait for CI to complete.

  5. Create a signed tag.

    git tag -a v$VERSION -s -m "Release $VERSION"
    git push origin --tags
  6. CI and goreleaser will handle the rest