Skip to content

Commit

Permalink
feat: releasing provider
Browse files Browse the repository at this point in the history
  • Loading branch information
awlsring committed Apr 18, 2023
1 parent d7a65d7 commit 5ae5db8
Show file tree
Hide file tree
Showing 27 changed files with 152 additions and 74 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with:
fetch-depth: 0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ HOSTNAME=github.com
NAMESPACE=awlsring
NAME=headscale
BINARY=terraform-provider-${NAME}
VERSION=0.1.1
OS_ARCH=darwin_arm64

default: install
Expand All @@ -15,7 +14,7 @@ gen:
swagger generate client -f ${SWAGGER_DOC} -A headscale -t ./internal/gen
go mod tidy

install: gen
install:
go install .

test:
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Terraform Proxmox Headscale

This is a Terraform provider for [Headscale](https://github.com/juanfont/headscale). This provider allows interaction with the Headscale API to manage and gather data on resources.

You can find this provider on the [Terraform Registry](https://registry.terraform.io/providers/awlsring/headscale/latest).

## Differences between the Tailscale and Headscale Providers

As Headscale has a different API than Tailscale, the functionality of this provider differs from what the [Tailscale provider](https://registry.terraform.io/providers/tailscale/tailscale) offers.

Some data sources and resources may offer similar functionality between these two providers, but for many of these the configuration options and functionality will be different. This provider contains data sources and resources the Tailscale provider does not offer and lacks some that it does.

## Getting Started

To install this provider in your project, you can copy the code snippet below into your project then run `terraform init`.

```hcl
terraform {
required_providers {
headscale = {
source = "awlsring/headscale"
version = "0.1.0"
}
}
}
provider "headscale" {
api_key = "api_key"
endpoint = "https://headscale.example.com"
}
```

In the `provider` block you will need to replace `api_key` and `endpoint` with the values for your Headscale instance. These can also be set via the environment variables `HEADSCALE_API_KEY` and `HEADSCALE_ENDPOINT`.

For further details on how to use this provider, please see the documentation in the `/docs` section of this repo or on the [Terraform Registry page](https://registry.terraform.io/providers/awlsring/headscale/latest/docs).
4 changes: 2 additions & 2 deletions docs/data-sources/api_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_api_keys Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The API key data source allows you to list all API keys on Headscale instance. This will only return the API key metadata and not the actual key.
The API key data source allows you to list all API keys on the Headscale instance. This will only return the API key metadata and not the actual key.
---

# headscale_api_keys (Data Source)

The API key data source allows you to list all API keys on Headscale instance. This will only return the API key metadata and not the actual key.
The API key data source allows you to list all API keys on the Headscale instance. This will only return the API key metadata and not the actual key.

## Example Usage

Expand Down
9 changes: 3 additions & 6 deletions docs/data-sources/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_device Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The device data source allows you to get information about a device registered in Headscale instance.
The device data source allows you to get information about a device registered on the Headscale instance.
---

# headscale_device (Data Source)

The device data source allows you to get information about a device registered in Headscale instance.
The device data source allows you to get information about a device registered on the Headscale instance.

## Example Usage

Expand All @@ -26,17 +26,14 @@ data "headscale_device" "first_host" {

- `id` (String) The id of the device

### Optional

- `register_method` (String) The method used to register the device.

### Read-Only

- `addresses` (List of String) List of the device's ip addresses.
- `created_at` (String) The time the device entry was created.
- `expiry` (String) The expiry date of the device.
- `given_name` (String) The device's given name.
- `name` (String) The device's name.
- `register_method` (String) The method used to register the device.
- `tags` (List of String) The tags applied to the device.
- `user` (String) The ID of the user who owns the device.

Expand Down
14 changes: 7 additions & 7 deletions docs/data-sources/device_subnet_routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_device_subnet_routes Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The device subnet routes data source allows you to get information on routes a device registered in Headscale instance advertises.
The device subnet routes data source allows you to get information on routes a device registered on the Headscale instance advertises.
---

# headscale_device_subnet_routes (Data Source)

The device subnet routes data source allows you to get information on routes a device registered in Headscale instance advertises.
The device subnet routes data source allows you to get information on routes a device registered on the Headscale instance advertises.

## Example Usage

Expand Down Expand Up @@ -40,20 +40,20 @@ data "headscale_device_subnet_routes" "enabled_devices" {

### Optional

- `status` (String) Filters the route list to elements whose status matches what is provided. Can be enabled or disabled.
- `status` (String) Filters the route list to elements whose status matches what is provided. Can be `enabled` or `disabled`.

### Read-Only

- `id` (String) The ID of the resource.
- `id` (String) The resolved ID of the device.
- `routes` (Attributes List) (see [below for nested schema](#nestedatt--routes))

<a id="nestedatt--routes"></a>
### Nested Schema for `routes`

Read-Only:

- `enabled` (Boolean) The status of the route
- `id` (String) The id of the route
- `route` (String) The subnet route
- `enabled` (Boolean) The status of the route.
- `id` (String) The id of the route.
- `route` (String) The subnet route.


9 changes: 3 additions & 6 deletions docs/data-sources/devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_devices Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The devices data source allows you to get information about devices registered in Headscale instance.
The devices data source allows you to get information about devices registered on the Headscale instance.
---

# headscale_devices (Data Source)

The devices data source allows you to get information about devices registered in Headscale instance.
The devices data source allows you to get information about devices registered on the Headscale instance.

## Example Usage

Expand Down Expand Up @@ -43,10 +43,6 @@ data "headscale_devices" "user_devices" {
<a id="nestedatt--devices"></a>
### Nested Schema for `devices`

Optional:

- `register_method` (String) The method used to register the device.

Read-Only:

- `addresses` (List of String) List of the device's ip addresses.
Expand All @@ -55,6 +51,7 @@ Read-Only:
- `given_name` (String) The device's given name.
- `id` (String) The id of the device
- `name` (String) The device's name.
- `register_method` (String) The method used to register the device.
- `tags` (List of String) The tags applied to the device.
- `user` (String) The ID of the user who owns the device.

Expand Down
12 changes: 6 additions & 6 deletions docs/data-sources/subnet_routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_subnet_routes Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The subnet routes data source allows you to get information on routes advertised by devices registered in the Headscale instance.
The subnet routes data source allows you to get information on routes advertised by devices registered on the Headscale instance.
---

# headscale_subnet_routes (Data Source)

The subnet routes data source allows you to get information on routes advertised by devices registered in the Headscale instance.
The subnet routes data source allows you to get information on routes advertised by devices registered on the Headscale instance.

## Example Usage

Expand Down Expand Up @@ -44,7 +44,7 @@ data "headscale_subnet_routes" "device_1_enabled_routes" {
### Optional

- `device_id` (String) Filters the route list to elements belonging to the device with the provided ID.
- `status` (String) Filters the route list to elements whose status matches what is provided. Can be enabled or disabled.
- `status` (String) Filters the route list to elements whose status matches what is provided. Can be `enabled` or `disabled`.

### Read-Only

Expand All @@ -58,9 +58,9 @@ Read-Only:

- `created_at` (String) The time the route entry was created.
- `device_id` (String) The device id the route is advertised by.
- `id` (String) The id of the route
- `route` (String) The subnet route
- `status` (String) The status of the route
- `id` (String) The id of the route.
- `route` (String) The subnet route.
- `status` (String) The status of the route.
- `user_id` (String) The ID of the user who owns the device the route belong to.


4 changes: 2 additions & 2 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_user Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The user data source allows you to get information about a user registered in the Headscale instance.
The user data source allows you to get information about a user registered on the Headscale instance.
---

# headscale_user (Data Source)

The user data source allows you to get information about a user registered in the Headscale instance.
The user data source allows you to get information about a user registered on the Headscale instance.

## Example Usage

Expand Down
5 changes: 3 additions & 2 deletions docs/data-sources/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_users Data Source - terraform-provider-headscale"
subcategory: ""
description: |-
The users data source allows you to get information about users registered in the Headscale instance.
The users data source allows you to get information about users registered on the Headscale instance.
---

# headscale_users (Data Source)

The users data source allows you to get information about users registered in the Headscale instance.
The users data source allows you to get information about users registered on the Headscale instance.

## Example Usage

Expand All @@ -22,6 +22,7 @@ data "headscale_users" "all" {}

### Read-Only

- `id` (String) The Terraform ID of the resource.
- `users` (Attributes List) (see [below for nested schema](#nestedatt--users))

<a id="nestedatt--users"></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/api_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_api_key Resource - terraform-provider-headscale"
subcategory: ""
description: |-
The API key resource allows you to create an API key that can be used to authenticate with the Headscale API. By default keys that are created with this resource will not expire. To create a key that expires, set the days_to_expire attribute to the number of days until the key expires. Keys cannot be modified, so any change to the input on this resource will cause the key to be expired and a new key to be created.
The API key resource allows you to create an API key that can be used to interact with the Headscale API. By default keys that are created with this resource will expire in 90 days. Keys cannot be modified, so any change to the input on this resource will cause the key to be expired and a new key to be created.
---

# headscale_api_key (Resource)

The API key resource allows you to create an API key that can be used to authenticate with the Headscale API. By default keys that are created with this resource will not expire. To create a key that expires, set the `days_to_expire` attribute to the number of days until the key expires. Keys cannot be modified, so any change to the input on this resource will cause the key to be expired and a new key to be created.
The API key resource allows you to create an API key that can be used to interact with the Headscale API. By default keys that are created with this resource will expire in 90 days. Keys cannot be modified, so any change to the input on this resource will cause the key to be expired and a new key to be created.

## Example Usage

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/device_subnet_routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_device_subnet_routes Resource - terraform-provider-headscale"
subcategory: ""
description: |-
The device subnet routes resource allows enabling routes advertised by a device registered in Headscale instance. Utilizing this resource will reset any previous configuration for routes advertised by the device. If a route was previously enabled, but is not present in the list of routes, it will be disabled.
The device subnet routes resource allows enabling routes advertised by a device registered on the Headscale instance. Utilizing this resource will reset any previous configuration for routes advertised by the device. If a route was previously enabled but is not present in the list of routes, it will be disabled.
---

# headscale_device_subnet_routes (Resource)

The device subnet routes resource allows enabling routes advertised by a device registered in Headscale instance. Utilizing this resource will reset any previous configuration for routes advertised by the device. If a route was previously enabled, but is not present in the list of routes, it will be disabled.
The device subnet routes resource allows enabling routes advertised by a device registered on the Headscale instance. Utilizing this resource will reset any previous configuration for routes advertised by the device. If a route was previously enabled but is not present in the list of routes, it will be disabled.

## Example Usage

Expand All @@ -30,6 +30,6 @@ resource "headscale_device_subnet_routes" "device_1" {

### Read-Only

- `id` (String) The id of the resource.
- `id` (String) The Terrafrom Id of the resource.


4 changes: 2 additions & 2 deletions docs/resources/device_tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "headscale_device_tags Resource - terraform-provider-headscale"
subcategory: ""
description: |-
The device tags resource allows setting tags on a device registered in Headscale instance. Utilizing this resource will reset any previous configuration for tags applied to the device. If a tag was previously applied, but is not present in the list of tags, it will be removed.
The device tags resource allows setting tags on a device registered on the Headscale instance. Utilizing this resource will reset any previous configuration for tags applied to the device. If a tag was previously applied but is not present in the list of tags, it will be removed.
---

# headscale_device_tags (Resource)

The device tags resource allows setting tags on a device registered in Headscale instance. Utilizing this resource will reset any previous configuration for tags applied to the device. If a tag was previously applied, but is not present in the list of tags, it will be removed.
The device tags resource allows setting tags on a device registered on the Headscale instance. Utilizing this resource will reset any previous configuration for tags applied to the device. If a tag was previously applied but is not present in the list of tags, it will be removed.

## Example Usage

Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ module github.com/awlsring/terraform-provider-headscale

go 1.19

require github.com/hashicorp/terraform-plugin-framework v1.2.0
require (
github.com/hashicorp/terraform-plugin-docs v0.14.1
github.com/hashicorp/terraform-plugin-framework v1.2.0
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
Expand All @@ -25,7 +28,6 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-json v0.16.0 // indirect
github.com/hashicorp/terraform-plugin-docs v0.14.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
Expand Down Expand Up @@ -64,7 +66,7 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-plugin v1.4.8 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/terraform-plugin-framework-validators v0.10.0
github.com/hashicorp/terraform-plugin-go v0.14.3
github.com/hashicorp/terraform-plugin-log v0.8.0
Expand Down
Loading

0 comments on commit 5ae5db8

Please sign in to comment.