- Clone the repository
- Enter the repository directory
- Build the provider using the Go
installcommand:
go installAdd the following block into your Terraform files (note that this provider requires Terraform 1.5 or greater):
terraform {
required_providers {
cortex = {
source = "cortexapps/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" |
This provider comes with the following resource types:
cortex_catalog_entitycortex_catalog_entity_custom_datacortex_departmentcortex_resource_definitioncortex_scorecard
And the following data sources:
cortex_catalog_entitycortex_catalog_entity_custom_datacortex_departmentcortex_resource_definitioncortex_scorecardcortex_team
Examples on each of these can be found in the examples/ folder.
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 thebuild/directory. -
Create a
~/.terraformrcfile that lets you override the default provider location:
provider_installation {
dev_overrides {
"cortexlocal/cortex" = "<path/to/terraform-provider-cortex/build"
}
direct {}
}- Use the
provideras:
terraform {
required_providers {
cortex = {
source = "cortexlocal/cortex"
}
}
}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 testaccThis 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 tidyThen commit the changes to go.mod and go.sum.