Skip to content

feat: init uberspace provider #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .copywrite.hcl

This file was deleted.

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.

7 changes: 0 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ updates:
schedule:
# Check for updates to Go modules every weekday
interval: "daily"
- package-ecosystem: "gomod"
directory: "/tools"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# TODO: Dependabot only updates hashicorp GHAs in the template repository, the following lines can be removed for consumers of this template
allow:
- dependency-name: "hashicorp/*"
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.

11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v4
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
# go-version-file: 'go.mod'
go-version: '1.24.0-rc.2'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
uses: crazy-max/ghaction-import-gpg@v6
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean
env:
Expand Down
58 changes: 34 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths-ignore:
- 'README.md'
push:
branches: [ main ]
paths-ignore:
- 'README.md'

Expand All @@ -22,64 +23,73 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
uses: golangci/golangci-lint-action@v6
with:
version: latest

generate:
name: Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
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
- uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
- run: make install_golangci_lint
- run: make generate
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)

# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- run: make test

# Run acceptance tests in a matrix with Terraform CLI versions
testacc:
name: Terraform Provider Acceptance Tests
needs: build
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.*'
timeout-minutes: 10
concurrency:
group: terraform-acctest
cancel-in-progress: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- run: go mod download

# Run acceptance tests for Terraform version 1.10.*
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
UBERSPACE_HOST: ${{ secrets.UBERSPACE_HOST }}
UBERSPACE_USER: ${{ secrets.UBERSPACE_USER }}
UBERSPACE_PRIVATE_KEY: ${{ secrets.UBERSPACE_PRIVATE_KEY }}
run: go test -v -cover ./internal/provider/
timeout-minutes: 10
54 changes: 30 additions & 24 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
max-per-linter: 0
max-same-issues: 0

run:
go: "1.23"
timeout: 5m
linters:
disable-all: true
enable:
- durationcheck
enable-all: true
disable:
- depguard
- err113
- errcheck
- copyloopvar
- forcetypeassert
- godot
- gofmt
- gosimple
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- exhaustruct
- gochecknoglobals
- gochecknoinits
- godox
- gosmopolitan
- ireturn
- lll
- mnd
- nlreturn
- nonamedreturns
- paralleltest
- perfsprint
- prealloc
- tagliatelle
- tenv
- unconvert
- unparam
- unused
- govet
- testpackage
- varnamelen
- wrapcheck
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/uberspace-community/terraform-provider-uberspace)
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.1.0 (Unreleased)

FEATURES:
### Features

- Add `uberspace` provider
- Add `uberspace_mycnf` data source
- Add `uberspace_user` data source
- Add `uberspace_crontab_entry` resource
- Add `uberspace_mysql_database` resource
- Add `uberspace_remote_file` resource
- Add `uberspace_supervisor_service` resource
- Add `uberspace_web_backend` resource
- Add `uberspace_web_domain` resource
40 changes: 40 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Developing & Contributing to the Provider

## Requirements

- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.24
- [uberspace](https://uberspace.de/) account in version U7

## Building The Provider

1. Clone the repository
2. Enter the repository directory
3. Build the provider using the Go `install` command:

```shell
go install
```

## Using the provider

If you are building the provider, follow the instructions to install it as a plugin.
After placing it into your plugins directory, run terraform init to initialize it.

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine
(see [Requirements](#requirements) above).

To compile the provider, run `go install`.
This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

To generate or update documentation, run `make generate`.

In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

```shell
make testacc
```
20 changes: 16 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
default: fmt lint install generate

.PHONY: build
build:
go build -v ./...

.PHONY: install
install: build
go install -v ./...

.PHONY: install_golangci_lint
install_golangci_lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.64.5

.PHONY: lint
lint:
golangci-lint run

generate:
cd tools; go generate ./...
.PHONY: generate
generate: fmt
go tool tfplugindocs generate

.PHONY: fmt
fmt:
go mod tidy
golangci-lint run --fix
terraform fmt -recursive ./examples/
gofmt -s -w -e .

.PHONY: test
test:
go test -v -cover -timeout=120s -parallel=10 ./...

.PHONY: testacc
testacc:
TF_ACC=1 go test -v -cover -timeout 120m ./...

.PHONY: fmt lint test testacc build install generate
4 changes: 1 addition & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Copyright (c) 2021 HashiCorp, Inc.

Mozilla Public License Version 2.0
==================================

Expand Down Expand Up @@ -372,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------

This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
defined by the Mozilla Public License, v. 2.0.
Loading