Skip to content

Latest commit

 

History

History
243 lines (205 loc) · 8.12 KB

repository.md

File metadata and controls

243 lines (205 loc) · 8.12 KB
page_title subcategory description
forgejo_repository Resource - forgejo
Forgejo repository resource

forgejo_repository (Resource)

Forgejo repository resource

Example Usage

terraform {
  required_providers {
    forgejo = {
      source = "svalabs/forgejo"
    }
  }
}

provider "forgejo" {
  host = "http://localhost:3000"
}

# Personal repository with default settings
# (owned by the authenticated user)
resource "forgejo_repository" "personal_defaults" {
  name = "personal_test_repo_defaults"
}
output "personal_debug_defaults" {
  value = forgejo_repository.personal_defaults
}

# Personal repository with custom settings
resource "forgejo_repository" "personal_non_defaults" {
  name           = "personal_test_repo_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"
  archived       = true

  internal_tracker = {
    enable_time_tracker                   = false
    allow_only_contributors_to_track_time = false
    enable_issue_dependencies             = false
  }
}
output "personal_debug_non_defaults" {
  value = forgejo_repository.personal_non_defaults
}

resource "forgejo_organization" "owner" {
  name = "test_org"
}

# Organization repository with default settings
# (owned by an organization)
resource "forgejo_repository" "org_defaults" {
  owner = forgejo_organization.owner.name
  name  = "org_test_repo_defaults"
}
output "org_debug_defaults" {
  value = forgejo_repository.org_defaults
}

# Organization repository with custom settings
resource "forgejo_repository" "org_non_defaults" {
  owner          = forgejo_organization.owner.name
  name           = "org_test_repo_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"
  archived       = true

  internal_tracker = {
    enable_time_tracker                   = false
    allow_only_contributors_to_track_time = false
    enable_issue_dependencies             = false
  }
}
output "org_debug_non_defaults" {
  value = forgejo_repository.org_non_defaults
}

resource "forgejo_user" "owner" {
  login    = "test_user"
  email    = "[email protected]"
  password = "passw0rd"
}

# User repository with default settings
# (owned by a different user)
resource "forgejo_repository" "user_defaults" {
  owner = forgejo_user.owner.login
  name  = "user_test_repo_defaults"
}
output "user_debug_defaults" {
  value = forgejo_repository.user_defaults
}

# User repository with custom settings
resource "forgejo_repository" "user_non_defaults" {
  owner          = forgejo_user.owner.login
  name           = "user_test_repo_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"
  archived       = true

  internal_tracker = {
    enable_time_tracker                   = false
    allow_only_contributors_to_track_time = false
    enable_issue_dependencies             = false
  }
}
output "user_debug_non_defaults" {
  value = forgejo_repository.user_non_defaults
}

Schema

Required

  • name (String) Name of the repository.

Optional

  • 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?
  • auto_init (Boolean) Whether the repository should be auto-intialized?
  • default_branch (String) Default branch of the repository.
  • description (String) Description of the repository.
  • external_tracker (Attributes) Settings for external issue tracker. (see below for nested schema)
  • external_wiki (Attributes) Settings for external wiki. (see below for nested schema)
  • gitignores (String) Gitignores to use
  • 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?
  • ignore_whitespace_conflicts (Boolean) Are whitespace conflicts ignored?
  • internal_tracker (Attributes) Settings for built-in issue tracker. (see below for nested schema)
  • issue_labels (String) Issue Label set to use
  • license (String) License to use
  • mirror_interval (String) Mirror interval of the repository.
  • owner (String) Owner of the 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

  • 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?
  • fork (Boolean) Is the repository a fork?
  • forks_count (Number) Number of forks of the repository.
  • full_name (String) Full name of the repository.
  • html_url (String) HTML URL of the repository.
  • id (Number) Numeric identifier of the repository.
  • internal (Boolean) Is the repository internal?
  • mirror (Boolean) Is the repository a mirror?
  • 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.
  • parent_id (Number) Numeric identifier of the parent repository.
  • permissions (Attributes) Permissions of the repository. (see below for nested schema)
  • 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.
  • updated_at (String) Time at which the repository was updated.
  • watchers_count (Number) Number of watchers of the repository.

Nested Schema for external_tracker

Optional:

  • 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

Optional:

  • external_wiki_url (String) URL of external wiki.

Nested Schema for internal_tracker

Optional:

  • 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?