diff --git a/README.md b/README.md
index f283d6d..8fe04ec 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@ It is in a **very early** stage and currently contains the following...
Resources:
- `forgejo_organization` ([documentation](docs/resources/organization.md))
+- `forgejo_repository` ([documentation](docs/resources/repository.md))
Data Sources:
@@ -85,10 +86,17 @@ resource "forgejo_organization" "example" {
}
data "forgejo_repository" "example" {
- owner = {
- login = "user"
- }
- name = "existing_repo"
+ owner = {}
+ name = "existing_repo"
+}
+
+resource "forgejo_repository" "example" {
+ owner = {}
+ name = "new_repo"
+ description = "Purely for testing..."
+ private = true
+ default_branch = "dev"
+ auto_init = true
}
```
diff --git a/docs/data-sources/repository.md b/docs/data-sources/repository.md
index 68f77ad..3cd705e 100644
--- a/docs/data-sources/repository.md
+++ b/docs/data-sources/repository.md
@@ -25,15 +25,26 @@ provider "forgejo" {
host = "http://localhost:3000"
}
-data "forgejo_repository" "this" {
+data "forgejo_repository" "user" {
owner = {
login = "achim"
}
- name = "test1"
+ name = "user_test_repo_1"
}
-output "debug" {
- value = data.forgejo_repository.this
+data "forgejo_repository" "org" {
+ owner = {
+ login = "test_org_1"
+ }
+ name = "org_test_repo_1"
+}
+
+output "user_debug" {
+ value = data.forgejo_repository.user
+}
+
+output "org_debug" {
+ value = data.forgejo_repository.org
}
```
diff --git a/docs/resources/organization.md b/docs/resources/organization.md
index 9d01adc..7f5503a 100644
--- a/docs/resources/organization.md
+++ b/docs/resources/organization.md
@@ -37,9 +37,13 @@ resource "forgejo_organization" "non_defaults" {
visibility = "private"
}
-output "debug" {
+output "debug_defaults" {
value = forgejo_organization.defaults
}
+
+output "debug_non_defaults" {
+ value = forgejo_organization.non_defaults
+}
```
diff --git a/docs/resources/repository.md b/docs/resources/repository.md
new file mode 100644
index 0000000..aef3c1a
--- /dev/null
+++ b/docs/resources/repository.md
@@ -0,0 +1,198 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "forgejo_repository Resource - forgejo"
+subcategory: ""
+description: |-
+ Forgejo repository resource
+---
+
+# forgejo_repository (Resource)
+
+Forgejo repository resource
+
+## Example Usage
+
+```terraform
+terraform {
+ required_providers {
+ forgejo = {
+ source = "registry.terraform.io/svalabs/forgejo"
+ }
+ }
+}
+
+provider "forgejo" {
+ host = "http://localhost:3000"
+}
+
+resource "forgejo_repository" "personal_defaults" {
+ owner = {}
+ name = "personal_tftest_defaults1"
+}
+resource "forgejo_repository" "personal_non_defaults" {
+ owner = {}
+ name = "personal_tftest_non_defaults"
+ description = "Terraform Test Repo owned by user with non-default attributes"
+ # website = "http://localhost:3000"
+ private = true
+ template = true
+ default_branch = "custom"
+ issue_labels = "Default"
+ auto_init = false
+ readme = "Default"
+ trust_model = "collaborator"
+}
+
+resource "forgejo_repository" "org_defaults" {
+ owner = {
+ login = "test_org_1"
+ }
+ name = "org_tftest_defaults"
+}
+resource "forgejo_repository" "org_non_defaults" {
+ owner = {
+ login = "test_org_1"
+ }
+ name = "org_tftest_non_defaults"
+ description = "Terraform Test Repo owned by org with non-default attributes"
+ # website = "http://localhost:3000"
+ private = true
+ template = true
+ default_branch = "custom"
+ issue_labels = "Default"
+ auto_init = false
+ readme = "Default"
+ trust_model = "collaborator"
+}
+
+output "personal_debug_defaults" {
+ value = forgejo_repository.personal_defaults
+}
+output "personal_debug_non_defaults" {
+ value = forgejo_repository.personal_non_defaults
+}
+
+output "org_debug_defaults" {
+ value = forgejo_repository.org_defaults
+}
+output "org_debug_non_defaults" {
+ value = forgejo_repository.org_non_defaults
+}
+```
+
+
+## Schema
+
+### Required
+
+- `name` (String) Name of the repository.
+- `owner` (Attributes) Owner of the repository. (see [below for nested schema](#nestedatt--owner))
+
+### Optional
+
+- `auto_init` (Boolean) Whether the repository should be auto-intialized?
+- `default_branch` (String) Default branch of the repository.
+- `description` (String) Description of the repository.
+- `gitignores` (String) Gitignores to use
+- `issue_labels` (String) Issue Label set to use
+- `license` (String) License to use
+- `parent_id` (Number) Numeric identifier of the parent repository.
+- `private` (Boolean) Is the repository private?
+- `readme` (String) Readme of the repository to create
+- `template` (Boolean) Is the repository a template?
+- `trust_model` (String) TrustModel of the repository
+- `website` (String) Website of the repository.
+
+### Read-Only
+
+- `allow_merge_commits` (Boolean) Allowed to create merge commit?
+- `allow_rebase` (Boolean) Allowed to rebase then fast-forward?
+- `allow_rebase_explicit` (Boolean) Allowed to rebase then create merge commit?
+- `allow_squash_merge` (Boolean) Allowed to create squash commit?
+- `archived` (Boolean) Is the repository archived?
+- `avatar_url` (String) Avatar URL of the repository.
+- `clone_url` (String) Clone URL of the repository.
+- `created_at` (String) Time at which the repository was created.
+- `default_merge_style` (String) Default merge style of the repository.
+- `empty` (Boolean) Is the repository empty?
+- `external_tracker` (Attributes) Settings for external issue tracker. (see [below for nested schema](#nestedatt--external_tracker))
+- `external_wiki` (Attributes) Settings for external wiki. (see [below for nested schema](#nestedatt--external_wiki))
+- `fork` (Boolean) Is the repository a fork?
+- `forks_count` (Number) Number of forks of the repository.
+- `full_name` (String) Full name of the repository.
+- `has_actions` (Boolean) Are integrated CI/CD pipelines enabled?
+- `has_issues` (Boolean) Is the repository issue tracker enabled?
+- `has_packages` (Boolean) Is the repository package registry enabled?
+- `has_projects` (Boolean) Are repository projects enabled?
+- `has_pull_requests` (Boolean) Are repository pull requests enabled?
+- `has_releases` (Boolean) Are repository releases enabled?
+- `has_wiki` (Boolean) Is the repository wiki enabled?
+- `html_url` (String) HTML URL of the repository.
+- `id` (Number) Numeric identifier of the repository.
+- `ignore_whitespace_conflicts` (Boolean) Are whitespace conflicts ignored?
+- `internal` (Boolean) Is the repository internal?
+- `internal_tracker` (Attributes) Settings for built-in issue tracker. (see [below for nested schema](#nestedatt--internal_tracker))
+- `mirror` (Boolean) Is the repository a mirror?
+- `mirror_interval` (String) Mirror interval of the repository.
+- `mirror_updated` (String) Time at which the repository mirror was updated.
+- `open_issues_count` (Number) Number of open issues of the repository.
+- `open_pr_counter` (Number) Number of open pull requests of the repository.
+- `original_url` (String) Original URL of the repository.
+- `permissions` (Attributes) Permissions of the repository. (see [below for nested schema](#nestedatt--permissions))
+- `release_counter` (Number) Number of releases of the repository.
+- `size` (Number) Size of the repository in KiB.
+- `ssh_url` (String) SSH URL of the repository.
+- `stars_count` (Number) Number of stars of the repository.
+- `watchers_count` (Number) Number of watchers of the repository.
+
+
+### Nested Schema for `owner`
+
+Optional:
+
+- `login` (String) Name of the user.
+
+Read-Only:
+
+- `email` (String) Email address of the user.
+- `full_name` (String) Full name of the user.
+- `id` (Number) Numeric identifier of the user.
+- `login_name` (String) Login name of the user.
+
+
+
+### Nested Schema for `external_tracker`
+
+Read-Only:
+
+- `external_tracker_format` (String) External issue tracker URL format.
+- `external_tracker_style` (String) External issue tracker number format.
+- `external_tracker_url` (String) URL of external issue tracker.
+
+
+
+### Nested Schema for `external_wiki`
+
+Read-Only:
+
+- `external_wiki_url` (String) URL of external wiki.
+
+
+
+### Nested Schema for `internal_tracker`
+
+Read-Only:
+
+- `allow_only_contributors_to_track_time` (Boolean) Let only contributors track time.
+- `enable_issue_dependencies` (Boolean) Enable dependencies for issues and pull requests.
+- `enable_time_tracker` (Boolean) Enable time tracking.
+
+
+
+### Nested Schema for `permissions`
+
+Read-Only:
+
+- `admin` (Boolean) Allowed to administer?
+- `pull` (Boolean) Allowed to pull?
+- `push` (Boolean) Allowed to push?