Skip to content

Commit

Permalink
Initial Abion Terraform plugin (#1)
Browse files Browse the repository at this point in the history
* Added initial support for resources, datasources and imports for A, AAAA, CNAME, MX, NS, PTR, SRV and TXT records

---------

Co-authored-by: Johan Körner <johan.korner@portsgroup.com>
  • Loading branch information
abiondevelopment and Johan Körner authored Nov 28, 2024
1 parent 388af26 commit 963f283
Show file tree
Hide file tree
Showing 103 changed files with 9,755 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
schema_version = 1

project {
license = "Apache-2.0"
copyright_year = 2024
copyright_holder = "Abion AB"

header_ignore = [
# examples used within documentation (prose)
"examples/**",

# GitHub issue template configuration
".github/ISSUE_TEMPLATE/*.yml",

# golangci-lint tooling configuration
".golangci.yml",

# GoReleaser tooling configuration
".goreleaser.yml",
]
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @abiondevelopment
5 changes: 5 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code of Conduct

HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.

Please read the full text at https://www.hashicorp.com/community-guidelines
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See GitHub's documentation for more information on this file:
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
21 changes: 21 additions & 0 deletions .github/workflows/issue-comment-triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DO NOT EDIT - This GitHub Workflow is managed by automation
# https://github.com/hashicorp/terraform-devex-repos
name: Issue Comment Triage

on:
issue_comment:
types: [created]

jobs:
issue_comment_triage:
runs-on: ubuntu-latest
env:
# issue_comment events are triggered by comments on issues and pull requests. Checking the
# value of github.event.issue.pull_request tells us whether the issue is an issue or is
# actually a pull request, allowing us to dynamically set the gh subcommand:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only
COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }}
GH_TOKEN: ${{ github.token }}
steps:
- name: 'Remove waiting-response on comment'
run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response
21 changes: 21 additions & 0 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# DO NOT EDIT - This GitHub Workflow is managed by automation
# https://github.com/hashicorp/terraform-devex-repos
name: 'Lock Threads'

on:
schedule:
- cron: '43 20 * * *'

jobs:
lock:
runs-on: ubuntu-latest
steps:
# NOTE: When TSCCR updates the GitHub action version, update the template workflow file to avoid drift:
# https://github.com/hashicorp/terraform-devex-repos/blob/main/modules/repo/workflows/lock.tftpl
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1
with:
github-token: ${{ github.token }}
issue-inactive-days: '30'
issue-lock-reason: resolved
pr-inactive-days: '30'
pr-lock-reason: resolved
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
196 changes: 196 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Terraform Provider testing workflow.
name: Tests

# This GitHub action runs your tests for each pull request.
on:
pull_request:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Format code
run: make fmt
- name: Verify code formatting
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after formatting. Run 'make fmt' command and commit."; exit 1)
- name: Run linters
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: latest
generate:
name: Generate Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
# We need the latest version of Terraform for our documentation generation to use
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- name: Generate docs
run: make generate
- name: Verify docs
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after docs generation. Run 'make generate' command and commit."; exit 1)
# Run acceptance tests in sequence for each supported Terraform CLI versions
test_1_5:
name: Terraform Provider Acceptance Tests v1.5.*
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.5.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
test_1_6:
name: Terraform Provider Acceptance Tests v1.6.*
needs: test_1_5
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.6.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
test_1_7:
name: Terraform Provider Acceptance Tests v1.7.*
needs: test_1_6
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.7.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
test_1_8:
name: Terraform Provider Acceptance Tests v1.8.*
needs: test_1_7
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.8.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
test_1_9:
name: Terraform Provider Acceptance Tests v1.9.*
needs: test_1_8
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.9.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
test_1_10:
name: Terraform Provider Acceptance Tests v1.10.*
needs: test_1_9
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.10.*'
terraform_wrapper: false
- run: go mod download
- env:
ABION_API_KEY: ${{ secrets.ABION_API_KEY }}
ABION_API_HOST: ${{ vars.ABION_API_HOST }}
run: make testacc
timeout-minutes: 20
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.dll
*.exe
.DS_Store
example.tf
terraform.tfplan
terraform.tfstate
bin/
dist/
modules-dev/
/pkg/
website/.vagrant
website/.bundle
website/build
website/node_modules
.vagrant/
*.backup
./*.tfstate
.terraform/
*.log
*.bak
*~
.*.swp
.idea
*.iml
*.test
*.iml

website/vendor

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

# Keep windows files with windows line endings
*.winfile eol=crlf
31 changes: 31 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
# Maximum issues count per one linter.
# Set to 0 to disable.
max-issues-per-linter: 0
# Maximum count of issues with the same text
# Set to 0 to disable.
max-same-issues: 0

linters:
disable-all: true
enable:
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- godot
- gofmt
- gosimple
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- tenv
- unconvert
- unparam
- unused
- vet
Loading

0 comments on commit 963f283

Please sign in to comment.