Skip to content

cloutierMat/terraform-provider-sendbird

Repository files navigation

Terraform Sendbird Provider

Initial Project to develop a Terraform provider for Senbird. Contributions are welcome and if some resources would be of a higher priority for you, please create an issue and I will add it to my priority list.

Requirements

Development

Building

  1. git clone this repository and cd into its directory
  2. make will trigger the Golang build The provided makefile defines additional commands generally useful during development, like for running tests, generating documentation, code formatting and linting. Taking a look at it's content is recommended.

Testing

Testing of Terraform Resources and Data Sources are implemented as acceptance testing.

Running a Acceptance Tests

Acceptance testing will create and destroy real resources against your senbird account. At the moment there is no known costs associated with any of the resources created, but it is recommended to run in a development environment to avoid potential side effects.

It is required to set your api key in you environment variables.

SENDBIRD_API_KEY=XXX

Once done, execute one of the following commands to run the test

# To run all tests
make testacc

# To run only a specific package
make testacc PKG=application

# To run only tests matching a Regex
make testacc TESTS=TestAccApplicationDataSource_

# or combined
make testacc TESTS=_create PKG=application

Generating the documentation

You can genarate the documentation for the Sendbird provider by using the following make command.

make generate

Using a development build

If running tests and acceptance tests isn't enough, it's possible to set up a local terraform configuration to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI configuration file development overrides.

First, use make install to place a fresh development build of the provider in your ${GOBIN} (defaults to ${GOPATH}/bin or ${HOME}/go/bin if ${GOPATH} is not set). Repeat this every time you make changes to the provider locally.

Then, setup your environment following these instructions to make your local terraform use your local build.

Testing GitHub Actions

This project uses GitHub Actions to realize its CI.

Sometimes it might be helpful to locally reproduce the behaviour of those actions, and for this we use act. Once installed, you can simulate the actions executed when opening a PR with:

# List of workflows for the 'pull_request' action
$ act -l pull_request

# Execute the workflows associated with the `pull_request' action 
$ act pull_request