Terraform Provider
- Website: https://www.terraform.io
- Mailing list: Google Groups
Requirements
Building The Provider
Clone repository to: $GOPATH/src/github.com/opsgenie/terraform-provider-opsgenie
$ mkdir -p $GOPATH/src/github.com/opsgenie; cd $GOPATH/src/github.com/opsgenie
$ git clone git@github.com:opsgenie/terraform-provider-opsgenie
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/opsgenie/terraform-provider-opsgenie
$ make build
Using the provider
Fill in for each provider
Developing the Provider
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.8+ 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-opsgenie
...
In order to test 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
Testing the Provider from Local Registry Version
- Create a
.terraformrc
file on your in your home folder usingvi ~/.terraformrc
- Add the local provider registry conf in
.terraformrc
provider_installation {
filesystem_mirror {
path = "~/terraform/providers"
include = ["test.local/*/*"]
}
direct {
exclude = ["test.local/*/*"]
}
}
- Run
make build
on local (it will internally trigger a hook to write totest.local
registry located in your~/terraform/providers
folder) - You can create a terraform basic project of your own locally with
main.tf
file
terraform {
required_providers {
opsgenie = {
source = "test.local/opsgenie/opsgenie"
version = "<local_version>"
}
}
}
# Configure the Opsgenie Provider
provider "opsgenie" {
api_key = <api_key>
api_url = "api.opsgenie.com" # can be a stage instance url for devs
}
- 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