Created
February 27, 2025 02:49
-
-
Save dukex/8ec14dc09ec6f26339ba506448731f07 to your computer and use it in GitHub Desktop.
terraform + openfga
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
openfga = { | |
source = "mauriceackel/openfga" | |
} | |
} | |
} | |
provider "openfga" { | |
api_url = "http://localhost:8080" | |
} | |
resource "openfga_store" "example" { | |
name = "example_store_name" | |
} | |
data "openfga_authorization_model_document" "model" { | |
mod_file_path = "${path.root}/models/fga.mod" | |
} | |
resource "openfga_authorization_model" "example" { | |
store_id = openfga_store.example.id | |
model_json = data.openfga_authorization_model_document.model.result | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module core | |
type user | |
type organization | |
relations | |
define member: [user] | |
define admin: [user] | |
type group | |
relations | |
define member: [user] | |
define can_edit: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schema: '1.2' | |
contents: | |
- core.fga | |
- issue-tracker/projects.fga | |
- issue-tracker/tickets.fga | |
- wiki.fga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module issue-tracker | |
extend type organization | |
relations | |
define can_create_project: admin | |
type project | |
relations | |
define organization: [organization] | |
define viewer: member from organization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module issue-tracker | |
type ticket | |
relations | |
define project: [project] | |
define owner: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module wiki | |
extend type organization | |
relations | |
define can_create_space: admin | |
type space | |
relations | |
define organization: [organization] | |
define can_view_pages: member from organization | |
type page | |
relations | |
define space: [space] | |
define owner: [user] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment