Skip to content

Commit

Permalink
Add initial project setup and features (#2)
Browse files Browse the repository at this point in the history
* Initial

* Implement data source and function

Signed-off-by: Kim Oliver Drechsel <[email protected]>

* Add missing docs

Signed-off-by: Kim Oliver Drechsel <[email protected]>

* go mod tidy

Signed-off-by: Kim Oliver Drechsel <[email protected]>

* Adjust naming

Signed-off-by: Kim Oliver Drechsel <[email protected]>

* Update README.md

Signed-off-by: Kim Oliver Drechsel <[email protected]>

* Adjust README.md

* Adjust code

* Remove test terraform

* Add addition check to test automatic type conversion from string to int

* Add example for addition to function

* Adjust workflows and github stuff

* Fix typos

---------

Signed-off-by: Kim Oliver Drechsel <[email protected]>
  • Loading branch information
kimdre authored Jun 12, 2024
1 parent bef00cc commit a8b7726
Show file tree
Hide file tree
Showing 46 changed files with 696 additions and 755 deletions.
21 changes: 0 additions & 21 deletions .copywrite.hcl

This file was deleted.

30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 160

[*.tf]
max_line_length = off
indent_size = 2

[Makefile]
indent_style = tab

[*.go]
indent_size = tab
indent_style = tab
ij_go_group_stdlib_imports = true
ij_go_import_sorting = goimports
ij_go_move_all_imports_in_one_declaration = true
ij_go_move_all_stdlib_imports_in_one_group = true
ij_go_remove_redundant_import_aliases = true
ij_go_run_go_fmt_on_reformat = true

[*.{yaml,yml}]
indent_size = 2
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

5 changes: 0 additions & 5 deletions .github/CODE_OF_CONDUCT.md

This file was deleted.

15 changes: 0 additions & 15 deletions .github/dependabot.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
changelog:
categories:
- title: 🚨 Breaking Changes
labels:
- Kind/Breaking
- title: ✨ Features
labels:
- Kind/Feature
- title: 🐛 Bug Fixes and Security
labels:
- Kind/Bug
- Kind/Security
- title: 🌟 Improvements
labels:
- Kind/Enhancement
- title: 📦 Dependencies
labels:
- Kind/Dependency
- title: 📚 Miscellaneous
labels:
- "*"
exclude_labels:
- Kind/Breaking
- Kind/Feature
- Kind/Bug
- Kind/Security
- Kind/Enhancement
- Kind/Dependency
21 changes: 0 additions & 21 deletions .github/workflows/issue-comment-triage.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/lock.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Spell checking

# Trigger on pull requests, and pushes to master branch.
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
# When using this Action in other repos, the --skip option below can be removed
skip: ./.git,go.mod,go.sum
ignore_words_list: AtLeast,AtMost
29 changes: 18 additions & 11 deletions .github/workflows/test.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ name: Tests
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
workflow_dispatch:

push:
branches:
- main
paths-ignore:
- 'README.md'
push:

pull_request:
paths-ignore:
- 'README.md'

Expand All @@ -29,11 +34,14 @@ jobs:
cache: true
- run: go mod download
- run: go build -v .
- run: go test -v ./...
- name: Run linters
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: latest

- run: go run github.com/bflad/tfproviderlint/cmd/tfproviderlintx@latest ./...

generate:
runs-on: ubuntu-latest
steps:
Expand All @@ -42,34 +50,33 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
# Temporarily download Terraform 1.8 prerelease for function documentation support.
# When Terraform 1.8.0 final is released, this can be removed.
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: '1.8.0-alpha20240216'
terraform_wrapper: false
- run: go mod tidy
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Run 'go mod tidy' command and commit."; git diff; exit 1)
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; git diff; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
concurrency: acctests
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.8.*'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.dll
*.exe
.DS_Store
example.tf
terraform.tfplan
terraform.tfstate
bin/
Expand All @@ -23,7 +22,6 @@ website/node_modules
.idea
*.iml
*.test
*.iml

website/vendor

Expand Down
51 changes: 49 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,74 @@
# yaml-language-server: $schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json

# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
max-per-linter: 0
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: _test\.go
linters:
- funlen
- dupword

linters:
disable-all: true
enable:
- asciicheck
- contextcheck
- durationcheck
- dupword
- errcheck
- exportloopref
- forcetypeassert
- forbidigo
- gci
- gochecknoglobals
- gocheckcompilerdirectives
- gochecknoinits
- gocognit
- gocritic
- godot
- gofmt
- gofumpt
- goimports
- gomoddirectives
- gosimple
- gosec
- govet
- ineffassign
- lll
- makezero
- misspell
- mirror
- nilerr
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- prealloc
- perfsprint
- predeclared
- staticcheck
- tagalign
- tagliatelle
- tenv
- testifylint
- unconvert
- unparam
- unused
- vet
- wastedassign
- wsl
- wrapcheck

linters-settings:
lll:
line-length: 160
tab-width: 4

tagliatelle:
case:
use-field-name: true
rules:
json: snake
tfsdk: snake
Loading

0 comments on commit a8b7726

Please sign in to comment.