Skip to content

ZEISS/terraform-provider-openfga

Repository files navigation

Terraform Provider OpenFGA

Test & Build Go Report Card License: MIT Taylor Swift

⚠️ This provider is still in development and should not be used in production environments.

Example

terraform {
  required_providers {
    openfga = {
      source = "zeiss/openfga"
    }
  }
}

provider "openfga" {
  api_url = "http://host.docker.internal:8080"
}

resource "openfga_store" "demo" {
  name = "demo"
}

resource "openfga_model" "demo" {
  spec = "{\"schema_version\":\"1.1\",\"type_definitions\":[{\"type\":\"user\"},{\"type\":\"document\",\"relations\":{\"reader\":{\"this\":{}},\"writer\":{\"this\":{}},\"owner\":{\"this\":{}}},\"metadata\":{\"relations\":{\"reader\":{\"directly_related_user_types\":[{\"type\":\"user\"}]},\"writer\":{\"directly_related_user_types\":[{\"type\":\"user\"}]},\"owner\":{\"directly_related_user_types\":[{\"type\":\"user\"}]}}}}]}"
  store = {
    id = openfga_store.demo.id
  }
}

resource "openfga_tuple" "demo" {
  user     = "user:demo"
  relation = "reader"
  document = "document:demo"

  store = {
    id    = openfga_store.demo.id
    model = openfga_model.demo.id
  }
}

Resources

  • openfga_store
  • openfga_model
  • openfga_tuple

Development

Run the following command to build the provider

sh ./scripts/setupDev.sh

License

MIT