Terraform OpsGenie provider
Everything needed to start local development and testing of the Provider plugin
export GOPATH="${GOPATH:=$HOME/go}"
mkdir -p "$GOPATH/src/github.com/opsgenie"
cd "$GOPATH/src/github.com/opsgenie"
git clone [email protected]:opsgenie/terraform-provider-opsgenie
export GOPATH="${GOPATH:=$HOME/go}"
cd "$GOPATH/src/github.com/opsgenie"
# Compile all versions of the provider and install it in GOPATH.
make build
# Only compile the local executable version (Faster)
make dev
Run all local unit tests.
make test
This configuration makes use of the dev_overrides
.
See the [Manual Setup][Manual Setup] for more details.
# Creates $HOME/.terraformrc
make setup
.terraformrc
file on your in your home folder using touch ~/.terraformrc
dev_overrides
in your ~/.terraformrc
as show below:
provider_installation {
dev_overrides {
# Remember to replace <home dir> with your username
"opsgenie/opsgenie" = "/home/<home dir>/go/bin"
}
direct {}
}
make build
Create a basic terraform project locally with a main.tf
file:
terraform {
required_providers {
opsgenie = {
source = "opsgenie/opsgenie"
version = ">=0.6.0" # version can be omitted
}
}
}
# Configure the Opsgenie Provider
provider "opsgenie" {
api_key = "<insert api_key>" # https://support.atlassian.com/opsgenie/docs/api-key-management/
api_url = "api.opsgenie.com" # can be a stage instance url for devs
}
resource "opsgenie_team" {
name = "Dev-Provider test team"
description = "New team made using in-development OpsGenie provider"
}
And, Add respective terraform change files which you want to apply on your OG instance
Run respective terraform commands to test the provider as per your convenience
Install the currently available provider with tf init
terraform plan
and terraform init
will use providers from the configured paths in $HOME/.terraformrc
terraform
will output an error if no provider is found in the dev_overrides
path. (make build
)
This allows you to use the normal release versions of the opsgenie/opsgenie
provider.
Note Removes $HOME/.terraformrc
make clean