Skip to content

statuspal/terraform-provider-statuspal

Repository files navigation

Terraform Provider StatusPal (Terraform Plugin Framework)

This a Terraform provider for interacting with StatusPal API.

Visit statuspal.io.

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
go install

Adding Dependencies

This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency github.com/author/dependency to your Terraform provider:

go get github.com/author/dependency
go mod tidy

Then commit the changes to go.mod and go.sum.

Using the provider

See the statuspal Provider documentation.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To compile the provider, run go install . from the root directory. This will build the provider and put the provider binary in the $GOPATH/bin directory.

In order to run the full suite of Acceptance tests, run TF_ENV=TEST TF_ACC=1 go test -v -cover ./internal/provider from the root directory.

To test manually the resource or data source, run from the root directory:

  • apply the terraform plan: TF_ENV=DEV terraform -chdir=./examples/<resource_or_data_source_name> apply --auto-approve
  • destroy the resource: TF_ENV=DEV terraform -chdir=./examples/<resource_or_data_source_name> destroy --auto-approve

To generate or update documentation, run go generate ./... from the root directory.

Note

For more information visit Implement a provider with the Terraform Plugin Framework:

  • Skip the Docker part in Set up your development environment section and you have to run statuspal/statushq locally.
  • In the Prepare Terraform for local provider install section, the ~/.terraformrc file should look like this:
    provider_installation {
      dev_overrides {
        "registry.terraform.io/statuspal/statuspal" = "<PATH>"
      }
    
      # For all other providers, install them directly from their origin provider
      # registries as normal. If you omit this, Terraform will _only_ use
      # the dev_overrides block, and so no other providers will be available.
      direct {}
    }

Create a provider release