Requirements
Building The Provider
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
Using the provider
Add the following block into your Terraform files (note that this provider requires Terraform 1.5 or greater):
terraform {
required_providers {
cortex = {
source = "cortex/cortex"
version = ">= 0.1"
}
}
required_version = ">= 1.5.0"
}
You'll need to set the environment variable CORTEX_API_TOKEN
with your Cortex API token.
You can optionally further configure the provider either inline in terraform:
provider "cortex" {
token = "my-api-token"
base_api_url = "https://api.getcortexapp.com" // default value, only set if changing
}
...or via ENV:
Key |
Description |
Default Value |
CORTEX_API_TOKEN |
Your Cortex.io API token |
"" |
CORTEX_API_URL |
The base API URL for Cortex's API. |
"https://api.getcortexapp.com" |
Resource Types
This provider comes with the following resource types:
And the following data sources:
Examples on each of these can be found in the examples/ folder.
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
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
To be able to use the locally installed provider,
-
Run go build -o build/terraform-provider-cortex .
This will build the binary and put it in the build/
directory.
-
Create a ~/.terraformrc
file that lets you override the default provider location:
provider_installation {
dev_overrides {
"cortexlocal/cortex" = "<path/to/terraform-provider-cortex/build"
}
direct {}
}
- Use the
provider
as:
terraform {
required_providers {
cortex = {
source = "cortexlocal/cortex"
}
}
}
Documentation
To generate or update documentation, run `go generate`.
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.
```shell
make testacc
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
.