terraform-provider-pathfinder

command module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

README

Terraform Provider: Pathfinder

[!CAUTION] HashiCorp Dev Advocates is a place where we share experimental software. These providers are rapidly evolving and might change in breaking ways. We can't guarantee their stability or that they'll be consistently available. We recommend using this Terraform Provider for experimentation and feedback only.

The Pathfinder Terraform provider allows you to interact with the Pathfinder API. The Pathfinder API provides movement planning for the Wave Rover, an unmanned ground vehicle (UGV) developed by Waveshare.

Usage

To use the Pathfinder Terraform provider, declare the provider as a required provider in your Terraform configuration:

terraform {
  required_providers {
    pathfinder = {
      source = "hashicorp-dev-advocates/pathfinder"
    }
  }
}
Configuring the Pathfinder provider

To configure the Pathfinder provider, specify the address of the Pathfinder API that's running on the Wave Rover:

provider "pathfinder" {
  address = "http://192.168.4.1:80"
  api_key = "your-api-key"
}
Managing movement

To instruct the device to move in a specific direction, use the pathfinder_movement resource. The following example moves the device forward and then right twice:

resource "pathfinder_movement" "example" {
  name = "example"
  steps {
    angle     = 0
    direction = "forward"
    distance  = 1
  }

  steps {
    angle     = 90
    direction = "right"
    distance  = 1
  }

  steps {
    angle     = 90
    direction = "right"
    distance  = 1
  }
}

Contributing

Requirements

Building The Provider

To compile the provider, run make install. This will build the provider and put the provider binary in the $GOPATH/bin directory.

make install

Using the provider locally

To use the provider locally, make sure to build the provider first. Then, create a .terraformrc file in your home directory with the following content:

provider_installation {
    dev_overrides {
        "hashicorp-dev-advocates/pathfinder" = "/Users/username/go/bin"
    }

    direct {}
}

This instructs terraform to use the locally built provider instead of the one from the Terraform Registry.

Running the acceptance tests

To run the acceptance tests, use the following command:

make testacc

Linting and formatting the code

We use golangci-lint to lint the Go code. To run the linter, use the following command:

make lint

To format the code, use the following command:

make fmt

Linting acceptance tests configurations

To lint the acceptance tests configurations, you’ll need to have terrafmt installed. Once installed, run the following command to lint:

make tests-lint-fix

Generating the documentation

Documentation is generated with tfplugindocs. To generate the documentation, run the following command:

make docs

To add copyright headers to the source files, you’ll need to have copywrite installed. Once installed, run the following command to add the headers:

make copyright

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