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

Setup Terraform and run the following command to test the provider

terraform init

Go to ./examples and run the following command to test the provider

terraform plan
terraform apply

License

MIT

About

(Experimental) OpenFGA Terraform Provider

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •