on2itsecurity / terraform-provider-auxo

Terraform provider for AUXO
MIT License
3 stars 1 forks source link

Terraform Provider Auxo

Provider and documentation can be found on the Terraform registry: https://registry.terraform.io/providers/on2itsecurity/auxo/latest

Usage

First resource creation

To prevent your token from being exposed, you can use the AUXOTOKEN environment variable to pass the token to Terraform. This way it doesn't need to be set in the terraform file(s).

export AUXO_TOKEN="YOURSECRETTOKEN"

Now you can create a main.tf file and add the provider configuration.

terraform {
  required_providers {
    auxo = {
      source  = "on2itsecurity/auxo"
    }
  }
}

Add a resource to your main.tf file, i.e. a location.

resource "auxo_location" "loc_zaltbommel" {
  name      = "Datacenter Zaltbommel"
  latitude  = 51.7983645
  longitude = 5.2548381
}

Initialize the workspace.

terraform init

Now you can create the plan and apply it.

terraform plan --out myfirstdeployment.plan
terraform apply myfirstdeployment.plan

If you want to destroy the resource, you can do so with the following command.

terraform destroy

Development

Install the provider for development

You can install the provider (locally) by cloning this repo and running make install.

git clone
git mod vendor
make install

This will make the provider avaialble to your local Terraform installation.

Using the locally build provider on a different machine

Below example assumes a Linux system.

GOOS=linux GOARCH=amd64 go build -o terraform-provider-auxo
scp ./terraform-provider-auxo <USER>@<DESTINATION.SERVER>:~/
mkdir -p ~/.terraform.d/plugins/on2itsecurity/auxo/0.1/linux_amd64
mv ~/terraform-provider-auxo ~/.terraform.d/plugins/on2itsecurity/auxo/0.1/linux_amd64/

Documentation

The documentation can be build using tfplugindocs.

tfplugindocs generate