Skip to content

Commit

Permalink
feat: initial code (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Brendan Le Glaunec <[email protected]>
  • Loading branch information
nrwiersma and Ullaakut authored Oct 17, 2023
1 parent ea39b61 commit 861a9de
Show file tree
Hide file tree
Showing 83 changed files with 13,646 additions and 23 deletions.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
groups:
all:
patterns:
- "*"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
groups:
all:
patterns:
- "*"
open-pull-requests-limit: 10
14 changes: 14 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
tags:
- '*'

name: release
jobs:
terraform-provider-release:
name: 'Terraform Provider Release'
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/community.yml@v2
secrets:
gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
with:
setup-go-version-file: 'go.mod'
47 changes: 47 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
on:
push:
branches:
- main
pull_request:

name: run tests
jobs:
test:

runs-on: ubuntu-latest
env:
GO_VERSION: "1.21"
GOLANGCI_LINT_VERSION: v1.54.2

steps:
- name: Install Go
if: success()
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v4

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --go ${{ env.GO_VERSION }}

- name: Run tests
run: go test -race ./...

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --snapshot
22 changes: 1 addition & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
/dist
62 changes: 62 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
run:
tests: false
timeout: 5m

linters-settings:
cyclop:
max-complexity: 15
skip-tests: true
lll:
line-length: 130
gofumpt:
extra-rules: true
gosec:
excludes:
- G101
- G402
tagliatelle:
case:
use-field-name: true
rules:
json: pascal

linters:
enable-all: true
disable:
- interfacer # deprecated
- scopelint # deprecated
- maligned # deprecated
- golint # deprecated
- gocyclo # duplicate of cyclop
- structcheck # deprecated
- ifshort # deprecated
- varcheck # deprecated
- deadcode # deprecated
- nosnakecase # deprecated
- exhaustivestruct # deprecated
- depguard
- dupl
- exhaustive
- exhaustruct
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- godox
- goerr113
- gomnd
- gomoddirectives
- ireturn
- lll
- nlreturn
- nonamedreturns
- tagliatelle
- varnamelen
- wrapcheck
- wsl

issues:
exclude-use-default: false
exclude:
- "ST1000: at least one file in a package should have a package comment"
- "package-comments: should have a package comment"
68 changes: 68 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
project_name: terraform-provider-ec
dist: dist

env:
- CGO_ENABLED=0

builds:
- id: terraform-provider-ec
binary: "terraform-provider-ec_{{ .Version }}"
flags:
- -trimpath
ldflags:
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}"
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- "386"
- arm
- arm64
ignore:
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
mod_timestamp: '{{ .CommitTimestamp }}'

checksum:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256

changelog:
skip: true

archives:
- format: zip
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'

signs:
- artifacts: checksum
stdin: '{{ .Env.GPG_PASSWORD }}'
args:
- "--batch"
- "--no-tty"
- "--pinentry-mode"
- "loopback"
- "--passphrase"
- '{{ .Env.GPG_PASSWORD }}'
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"

snapshot:
name_template: 'dev-{{ slice .FullCommit 0 8}}'
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#Cleanup

fmt:
@echo "==> Formatting source"
@gofmt -s -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@echo "==> Done"
.PHONY: fmt

#Test

test:
@go test -cover -race ./...
.PHONY: test

#Lint

lint:
@golangci-lint run --config=.golangci.yml ./...
.PHONY: lint

#Build

build:
@goreleaser release --clean --snapshot
.PHONY: build

# Schema Generation

schema-gen:
@go run ./internal/cmd/schema-gen/
.PHONY: schema-gen
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# terraform-provider-ec
Terraform provider for Nitrado Enterprise Console
# Armada Terraform Provider

Armada Terraform provider allowing to interact with Enterprise Console Armada via Terraform.

## Usage

See the [docs](docs/index.md) to find supported resources and data sources.

## Development

### Documentation Generation

The documentation is generated using Go's `generate` command:

```shell
go generate
```
3 changes: 3 additions & 0 deletions doc.generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate
Loading

0 comments on commit 861a9de

Please sign in to comment.