Skip to content

Commit

Permalink
Merge pull request #19 from josh-silvas/feature/next-server
Browse files Browse the repository at this point in the history
Adds support for subnet `next-server` configuration.
  • Loading branch information
josh-silvas authored Jun 6, 2024
2 parents d16cc4f + 7dc7c0d commit 4f06e72
Show file tree
Hide file tree
Showing 1,024 changed files with 51,002 additions and 17,126 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- name: "Run GoReleaser"
uses: "goreleaser/goreleaser-action@3fa32b8bb5620a2c1afe798654bbad59f9da4906" # v4.4.0
with:
version: "v1.26.2"
args: "release --clean"
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- name: "Run Linting Process"
uses: "golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299" # v3.6.0
with:
version: "latest"
version: "v1.54.2"
args: "--config=.golangci.yml"

generate:
runs-on: "ubuntu-latest"
Expand Down
34 changes: 3 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
*.dll
*.exe
*/**/.DS_Store
example.tf
terraform.tfplan
terraform.tfstate
bin/
dist/
modules-dev/
/pkg/
*.backup
./*.tfstate
.terraform/
*.log
*.bak
*~
.*.swp
.idea
*.iml
*.test

# Ignore all .tfstate files
*/**/.terraform.lock.hcl
*/**/terraform.tfstate
*/**/terraform.tfstate.backdup
*/**/.terraform

# Ignore binary files
develop/terraform-provider-kea
develop/terraform.tfstate.backup
develop/terraform.tfstate
develop/.terraform.lock.hcl
develop/.env

# Test exclusions
!command/test-fixtures/**/*.tfstate
!command/test-fixtures/**/.terraform/

# Keep windows files with windows line endings
*.winfile eol=crlf
62 changes: 22 additions & 40 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
run:
concurrency: 4
timeout: "5m"
issues-exit-code: "1"
issues-exit-code: 1
tests: true
skip-dirs:
- "Formula"
- "build"
- ".idea"
skip-dirs-use-default: true
skip-files:
- ".*\\.my\\.go$"
allow-parallel-runners: false


# output configuration options
output:
format: "colored-line-number"
formats:
- format: "colored-line-number"
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
Expand Down Expand Up @@ -80,19 +74,6 @@ linters-settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
checks:
- "argument"
- "case"
- "condition"
- "operation"
- "return"
- "assign"
govet:
# report about shadowed variables
check-shadowing: false
Expand All @@ -114,22 +95,22 @@ linters-settings:
- "shadow"
disable-all: false
depguard:
list-type: "blacklist"
include-go-root: false
packages:
- "github.com/sirupsen/logrus"
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
rules:
logrus:
# package name
files:
- "github.com/sirupsen/logrus"
# list of allowed functions
deny:
- pkg: "logrus.New"
- pkg: "logrus.WithField"
- pkg: "logrus.WithFields"
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# tab width in spaces. Default to 1.
tab-width: 1
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
Expand All @@ -141,8 +122,6 @@ linters-settings:
nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
# Exclude following linters from requiring an explanation. Default is [].
allow-no-explanation: []
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
Expand Down Expand Up @@ -174,26 +153,29 @@ issues:
exclude-use-default: false
exclude:
- ".*Close|.*Flush|.*printf?|should have a package comment"
exclude-dirs:
- "Formula"
- "build"
- ".idea"
exclude-files:
- ".*\\.my\\.go$"
exclude-rules:
- linters:
- "staticcheck"
text: "SA5008:"

linters:
enable:
- "megacheck"
- "gosimple"
- "staticcheck"
- "unused"
- "govet"
# The linter 'golint' is deprecated (since v1.41.0) due to:
# The repository of the linter has been archived by the owner. Replaced by revive.
- "revive"
- "unused"
disable:
- "maligned"
- "prealloc"
- "scopelint"
- "deadcode"
- "structcheck"
- "varcheck"
- "rowserrcheck"
- "sqlclosecheck"
disable-all: false
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.2
v0.3.4
2 changes: 1 addition & 1 deletion develop/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ALPINE_VERSION=3.16

# GOLANG SETTINGS
GORELEASER_VERSION=1.4.1
GOLANGCILINT_VERSION=1.50.1
GOLANGCILINT_VERSION=1.59.0
TERRAFORM_VERSION=1.3.7

# GITHUB SETTINGS
Expand Down
19 changes: 19 additions & 0 deletions develop/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ resource "kea_remote_subnet4_resource" "example_subnet4_resource" {
{code = 15, name = "domain-name", data = "example.com", always_send = true},
{code = 6, name = "domain-name-servers", data = "4.2.2.2, 8.8.8.8", always_send = true},
]
next_server = "10.10.10.10"
server_hostname = "example-server"
boot_file_name = "example-boot-file"
}

resource "kea_remote_subnet4_resource" "example_subnet4_resource_2" {
hostname = local.hostname
subnet = "192.168.100.0/24"
pools = [
{pool = "192.168.100.50-192.168.100.150"}
]
relay = [
{ip_address = "192.168.100.1"}
]
option_data = [
{code = 3, name = "routers", data = "192.168.100.1", always_send = true},
{code = 15, name = "domain-name", data = "example.com", always_send = true},
{code = 6, name = "domain-name-servers", data = "4.2.2.2, 8.8.8.8", always_send = true},
]
}

resource "kea_reservation_resource" "example_reservation_resource" {
Expand Down
3 changes: 3 additions & 0 deletions docs/resources/remote_subnet4_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ resource "kea_remote_subnet4_resource" "example" {

### Optional

- `boot_file_name` (String) Optional conveys the boot configuration file, can be up to 128 bytes long, and is sent using the `file` field.
- `next_server` (String) Optional TFTP boot server IP address, packets sent in the `siaddr` field.
- `option_data` (Attributes List) List of option-data to configure on the pool. e.g. `[{code = 6, name = "domain-name-servers", data = "8.8.8.8, 4.2.2.2"}]` (see [below for nested schema](#nestedatt--option_data))
- `relay` (Attributes List) List of relay IPs to configure in Kea. e.g. `['192.168.230.1']` (see [below for nested schema](#nestedatt--relay))
- `server_hostname` (String) Optional, conveys a server hostname, can be up to 64 bytes long, and is in the `sname` field.
- `user_context` (Map of String) Arbitrary string data to tie to the subnet. e.g. `{site = "AUS", name = "Austin, Tx"}`

### Read-Only
Expand Down
67 changes: 35 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
module github.com/josh-silvas/terraform-provider-kea

go 1.19
go 1.21

toolchain go1.21.5

require (
github.com/davecgh/go-spew v1.1.1
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.4.2
github.com/hashicorp/terraform-plugin-go v0.19.0
github.com/hashicorp/terraform-plugin-go v0.22.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/hashicorp/terraform-plugin-testing v1.7.0
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.5.2 // indirect
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
github.com/hashicorp/hc-install v0.6.3 // indirect
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-json v0.17.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-exec v0.20.0 // indirect
github.com/hashicorp/terraform-json v0.21.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
Expand All @@ -61,17 +63,18 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.13.3 // indirect
golang.org/x/crypto v0.14.0 // indirect
github.com/zclconf/go-cty v1.14.3 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
)
Loading

0 comments on commit 4f06e72

Please sign in to comment.