Skip to content

Commit d19b107

Browse files
authored
Merge pull request #16 from appwrite/CLO-4192-polish-terraform-setup
feat: polish the repository and terraform setup
2 parents 14d1a8a + 2095f62 commit d19b107

75 files changed

Lines changed: 2590 additions & 328 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Global owners for all files in the repository
2+
* @levivannoort
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug in the Appwrite Terraform provider
4+
title: ""
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of the bug.
12+
13+
## Terraform Configuration
14+
15+
```hcl
16+
# Minimal Terraform configuration to reproduce the issue
17+
```
18+
19+
## Expected Behavior
20+
21+
What you expected to happen.
22+
23+
## Actual Behavior
24+
25+
What actually happened. Include any error messages.
26+
27+
## Steps to Reproduce
28+
29+
1. Run `terraform plan` with the above configuration
30+
2. ...
31+
32+
## Environment
33+
34+
- Terraform version: (output of `terraform version`)
35+
- Provider version:
36+
- Appwrite version: (Cloud or Community Edition version)
37+
- OS:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new resource, data source, or improvement
4+
title: ""
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of the feature you'd like.
12+
13+
## Use Case
14+
15+
Why is this feature needed? What problem does it solve?
16+
17+
## Proposed Configuration
18+
19+
```hcl
20+
# Example of how the feature would be used in Terraform
21+
```
22+
23+
## Additional Context
24+
25+
Any other context, links to Appwrite documentation, or screenshots.

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Description
2+
3+
Brief description of the changes.
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix
8+
- [ ] New resource or data source
9+
- [ ] Enhancement to existing resource
10+
- [ ] Documentation
11+
- [ ] Other
12+
13+
## Checklist
14+
15+
- [ ] `make lint` passes
16+
- [ ] `make test` passes
17+
- [ ] `make docs` has been run and changes committed
18+
- [ ] Acceptance tests added/updated (for resource changes)
19+
- [ ] Examples added/updated (for new resources/data sources)

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ jobs:
3232
go-version-file: go.mod
3333
cache: true
3434

35-
- name: Go vet
36-
run: go vet ./...
35+
- name: golangci-lint
36+
run: |
37+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
38+
golangci-lint run
3739
3840
- name: Check formatting
3941
run: |

.golangci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
linters:
2+
enable:
3+
# Default linters
4+
- errcheck
5+
- gosimple
6+
- govet
7+
- ineffassign
8+
- staticcheck
9+
- unused
10+
11+
# Code style
12+
- gofmt
13+
- goimports
14+
- misspell
15+
- unconvert
16+
- whitespace
17+
18+
# Bug detection
19+
- bodyclose
20+
- durationcheck
21+
- nilerr
22+
- noctx
23+
- rowserrcheck
24+
- sqlclosecheck
25+
- wastedassign
26+
27+
# Code complexity & maintenance
28+
- copyloopvar
29+
- dupword
30+
- errname
31+
- errorlint
32+
- fatcontext
33+
- goconst
34+
- goprintffuncname
35+
- makezero
36+
- nosprintfhostport
37+
- prealloc
38+
- predeclared
39+
- reassign
40+
- revive
41+
- usetesting
42+
- tparallel
43+
- usestdlibvars
44+
45+
linters-settings:
46+
errcheck:
47+
check-type-assertions: true
48+
goconst:
49+
min-len: 3
50+
min-occurrences: 3
51+
misspell:
52+
locale: US
53+
revive:
54+
rules:
55+
- name: blank-imports
56+
- name: context-as-argument
57+
- name: context-keys-type
58+
- name: dot-imports
59+
- name: error-return
60+
- name: error-strings
61+
- name: error-naming
62+
- name: exported
63+
disabled: true
64+
- name: increment-decrement
65+
- name: var-naming
66+
- name: range
67+
- name: receiver-naming
68+
- name: time-naming
69+
- name: unexported-return
70+
- name: indent-error-flow
71+
- name: errorf
72+
- name: empty-block
73+
- name: superfluous-else
74+
- name: unused-parameter
75+
disabled: true
76+
- name: unreachable-code
77+
- name: redefines-builtin-id
78+
79+
issues:
80+
exclude-dirs:
81+
- vendor
82+
max-issues-per-linter: 0
83+
max-same-issues: 0
84+
85+
run:
86+
timeout: 5m

CHANGELOG.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Data sources for storage buckets, users, teams, functions, sites, topics, and webhooks
13+
- Schema validators for deployment `source_type`, bucket `compression`, and function `name`/`runtime`
14+
- User-Agent header (`terraform-provider-appwrite/<version>`) on all API calls
15+
- Acceptance tests for function and site deployment resources and data sources
16+
- `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, and GitHub issue templates
17+
- `CODEOWNERS` file and pull request template
18+
- `golangci-lint` in CI pipeline
19+
- Import support for function and site deployment resources
20+
21+
## [1.2.1] - 2026-04-17
22+
23+
### Fixed
24+
25+
- Index creation resource handling
26+
- Duplicate example files removed from the repository
27+
28+
## [1.2.0] - 2026-04-17
29+
30+
### Changed
31+
32+
- Upgraded `go-sdk` to `v3.0.0` with webhook field renames
33+
34+
## [1.1.0] - 2026-04-17
35+
36+
### Added
37+
38+
- Deployment resources for sites and functions
39+
- Documentation and examples for deployment resources
40+
41+
## [1.0.2] - 2026-04-17
42+
43+
### Changed
44+
45+
- Polished repository README
46+
47+
### Fixed
48+
49+
- Added `WaitForColumnAvailable` preventing column creation errors
50+
- Error handling for self-hosted API limitations
51+
52+
## [1.0.1] - 2026-04-13
53+
54+
### Changed
55+
56+
- Refactored documentation
57+
58+
## [1.0.0] - 2026-04-12
59+
60+
### Added
61+
62+
- Resources for functions and sites with their respective variables
63+
- Cleaned up documentation
64+
65+
## [0.0.8] - 2026-04-12
66+
67+
### Added
68+
69+
- Initial release with support for TablesDB, Storage, Auth, Messaging, Webhooks, and Backup Policies
70+
- Acceptance tests for all resources
71+
- Auto-generated documentation via `terraform-plugin-docs`

CONTRIBUTING.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing to Terraform Provider for Appwrite
2+
3+
Thank you for your interest in contributing! This document provides guidelines for contributing to the Appwrite Terraform provider.
4+
5+
## Development Setup
6+
7+
### Prerequisites
8+
9+
- [Go](https://golang.org/doc/install) (see `go.mod` for required version)
10+
- [Terraform](https://www.terraform.io/downloads.html) >= 1.0
11+
- An Appwrite instance (Cloud or Community Edition) for acceptance testing
12+
13+
### Building
14+
15+
```bash
16+
make build
17+
```
18+
19+
### Installing Locally
20+
21+
```bash
22+
make install
23+
```
24+
25+
This installs the provider to `~/.terraform.d/plugins/` for local testing.
26+
27+
### Running Tests
28+
29+
Unit tests:
30+
31+
```bash
32+
make test
33+
```
34+
35+
Acceptance tests (requires a running Appwrite instance):
36+
37+
```bash
38+
export APPWRITE_ENDPOINT="https://cloud.appwrite.io/v1"
39+
export APPWRITE_PROJECT_ID="your-project-id"
40+
export APPWRITE_API_KEY="your-api-key"
41+
make acceptance-test
42+
```
43+
44+
### Linting
45+
46+
```bash
47+
make lint
48+
```
49+
50+
### Generating Documentation
51+
52+
```bash
53+
make docs
54+
```
55+
56+
Documentation is auto-generated from schema definitions and examples using [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs). Always run `make docs` after changing resource schemas or examples.
57+
58+
## Adding a New Resource
59+
60+
1. Create a new directory under `internal/services/<service>/`
61+
2. Implement `resource.go` with the Plugin Framework interfaces
62+
3. Add the resource to `provider.go` in the `Resources()` method
63+
4. Create an example in `examples/resources/appwrite_<resource_name>/resource.tf`
64+
5. Create an import example in `examples/resources/appwrite_<resource_name>/import.sh`
65+
6. Create a doc template in `templates/resources/<resource_name>.md.tmpl`
66+
7. Write acceptance tests in `resource_test.go`
67+
8. Run `make docs` to generate documentation
68+
69+
## Adding a New Data Source
70+
71+
Follow the same pattern as resources, but use `datasource.DataSource` interface and register in the `DataSources()` method.
72+
73+
## Pull Request Process
74+
75+
1. Fork the repository and create a feature branch
76+
2. Write or update tests for your changes
77+
3. Run `make lint` and `make test` to verify your changes
78+
4. Run `make docs` and commit any generated documentation changes
79+
5. Open a pull request with a clear description of the changes
80+
81+
## Code Style
82+
83+
- Follow standard Go conventions (`gofmt`, `go vet`)
84+
- Use the Terraform Plugin Framework (not SDK v2) for new resources
85+
- Keep resource implementations consistent with existing patterns
86+
- Mark sensitive fields with `Sensitive: true`
87+
- Handle 404 errors in Read by calling `resp.State.RemoveResource(ctx)`

SECURITY.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| latest | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
If you discover a security vulnerability in this Terraform provider, please report it responsibly.
12+
13+
**Do not open a public GitHub issue for security vulnerabilities.**
14+
15+
Instead, please report vulnerabilities to [security@appwrite.io](mailto:security@appwrite.io).
16+
17+
Include the following information:
18+
19+
- Description of the vulnerability
20+
- Steps to reproduce
21+
- Potential impact
22+
- Suggested fix (if any)
23+
24+
We will acknowledge receipt within 48 hours and provide a detailed response within 7 days.

0 commit comments

Comments
 (0)