Skip to content

observeinc/terraform-provider-observe

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ddd4ebb · May 31, 2024
Jan 31, 2024
May 16, 2024
May 31, 2024
May 31, 2024
Oct 27, 2023
May 16, 2024
May 9, 2024
May 9, 2024
Nov 13, 2023
Jan 25, 2024
Dec 10, 2019
Aug 2, 2023
Jul 25, 2023
Aug 25, 2023
May 9, 2024
Dec 10, 2019
Aug 2, 2023
Jan 25, 2024
Jan 25, 2024
Dec 12, 2023
Jul 25, 2023

Repository files navigation

Observe Terraform Provider

Requirements

Building The Provider

git clone [email protected]:observeinc/terraform-provider-observe.git

When it comes to building you have two options:

go install

If you don't mind installing the development version of the provider globally, you can use go install in the provider directory which will build and link the binary into your $GOBIN directory.

go install

go build

If you would rather install the provider locally and not impact the stable version you already have installed, you can use the ~/.terraformrc file to tell Terraform where your provider is. You do this by building the provider using Go.

go build -o terraform-provider-observe

And then update your ~/.terraformrc file to point at the location you've built it.

provider_installation {
dev_overrides {
  "terraform.observeinc.com/observeinc/observe" = "path/to/terraform-provider-observe/terraform-provider-observe"
}
# 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 {}
}

A caveat with this approach is that you will need to run terraform init whenever the provider is rebuilt. You'll also need to remember to comment it/remove it when it's not in use to avoid tripping yourself up.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.18+ is required).

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

make test

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.

make testacc

To print debug logs during acceptance tests, including all HTTP requests and responses, set TF_LOG=debug:

TF_LOG=debug make testacc

Managing Dependencies

Terraform providers use [Go modules][go modules] to manage the dependencies. To add or update a dependency, you would run the following (v1.2.3 of foo is a new package we want to add):

go get [email protected]
go mod tidy
go mod vendor