Use the in-repo chart by default and check it before touching the cluster, bind the port-forward to 127.0.0.1 and fail when it does not start, build from the module directory, and point dev_overrides at the directory holding the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
terraform-provider-seaweedfs
Terraform and OpenTofu provider for SeaweedFS S3, IAM, and S3 Tables APIs. The provider targets SeaweedFS 4.51 API behavior and supports importing every managed resource; each resource's documentation lists its import identifier.
Originally written by Luís Costa as terraform-provider-seaweedfs and licensed under the MIT license in LICENSE.
Managed resources
- S3 buckets: bucket lifecycle and tags, CORS, lifecycle rules, versioning, bucket policies, encryption, public access block, ownership controls, requester-pays configuration, and SeaweedFS bucket quotas.
- IAM: users, access keys, inline user/group policies, groups and authoritative group membership, roles and trust policies, managed policies, user/group/role policy attachments, OIDC providers, and service accounts.
- S3 Tables: table buckets and policies, namespaces, Iceberg tables and table policies, resource tags, and bucket/table maintenance configuration.
S3 bucket configuration documents and S3 Tables table metadata are passed as JSON strings using the SeaweedFS/AWS API field names. IAM and S3 Tables policy documents are JSON strings as well.
Lifecycle and secret notes
- Destroying bucket versioning suspends versioning; S3 has no operation to remove the versioning configuration. Request-payment destroy resets the payer to the bucket owner, and quota destroy disables the quota.
- S3 Tables maintenance configuration has no delete API; destroy disables the maintenance type.
- A service-account secret is returned only at creation and is retained in
Terraform state.
sensitivemasks CLI output but does not encrypt state. Use an encrypted, access-controlled state backend and protect state backups. - SeaweedFS stores one active managed-policy version; policy updates replace that document in place.
Object data operations, cluster installation, and irreversible object-lock configuration are intentionally not modeled as Terraform resources.
SeaweedFS compatibility
IAM feature availability can vary between SeaweedFS deployments. In particular,
CreateAccessKey has returned ServiceFailure: Internal server error in some
deployments. Run the integration smoke test against the exact SeaweedFS version
and configuration you intend to use before relying on IAM resources.
Build
cd terraform/provider
go build -o bin/terraform-provider-seaweedfs .
Generate Docs
make docs
This runs tfplugindocs via go generate and updates files under docs/.
Use locally with Terraform
Create ~/.terraformrc:
provider_installation {
dev_overrides {
"seaweedfs/seaweedfs" = "/absolute/path/to/seaweedfs/terraform/provider/bin"
}
direct {}
}
Then in your Terraform config:
terraform {
required_providers {
seaweedfs = {
source = "seaweedfs/seaweedfs"
}
}
}
provider "seaweedfs" {
endpoint = "https://s3.example.com"
region = "us-east-1"
access_key = var.admin_access_key
secret_key = var.admin_secret_key
}
resource "seaweedfs_iam_user" "example" {
name = "example-user"
}
endpoint, access_key, and secret_key may alternatively be supplied by
SEAWEEDFS_ENDPOINT, SEAWEEDFS_ACCESS_KEY, and SEAWEEDFS_SECRET_KEY.
SEAWEEDFS_REGION defaults to us-east-1; SEAWEEDFS_INSECURE accepts
true/false and defaults to false. Explicit provider configuration takes
precedence over environment variables.
Tests
make test-race
make lint
The terraform: validate and test modules workflow builds, vets and
unit-tests this module on every change under terraform/.
Local SeaweedFS integration smoke test
The smoke fixture exercises bucket/tagging, core IAM, S3 Tables, and table maintenance create/read behavior with OpenTofu against SeaweedFS 4.51:
make test-race
tofu fmt -check -recursive
./scripts/minikube-smoke.sh
The script requires a running Minikube profile, seaweedfs-podman-smoke by
default (set MINIKUBE_PROFILE to use another). It installs the chart from
k8s/charts/seaweedfs unless SEAWEEDFS_CHART points elsewhere, and forwards
the S3 port to 127.0.0.1:${SEAWEEDFS_LOCAL_PORT:-8333}. It creates the namespace and Helm
resources if needed, but does not delete the cluster, release, or Terraform
resources. It applies the example automatically; use only a disposable test
cluster and review the local example state before any manual cleanup.