terraform-provider-cortex

command module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 5 Imported by: 0

README

Cortex Terraform Provider

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. 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,

  1. Run go build -o build/terraform-provider-cortex . This will build the binary and put it in the build/ directory.

  2. 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 {}
}
  1. 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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL