pre release version bump

make fmt
clarified some limitations for fork resource
pull/19/head
Tobias Trabelsi 2 years ago
parent f3c0793a88
commit 6d0bd5906a
No known key found for this signature in database
GPG Key ID: FF0C2839718CAF2E

@ -17,7 +17,7 @@ terraform {
required_providers {
gitea = {
source = "Lerentis/gitea"
version = "0.8.0"
version = "0.9.0"
}
}
}

@ -3,14 +3,44 @@
page_title: "gitea_fork Resource - terraform-provider-gitea"
subcategory: ""
description: |-
gitea_fork manages repository fork
gitea_fork manages repository fork to the current user or an organisation
Forking a repository to a dedicated user is currently unsupported
Creating a fork using this resource without an organisation will create the fork in the executors name
---
# gitea_fork (Resource)
`gitea_fork` manages repository fork
`gitea_fork` manages repository fork to the current user or an organisation
Forking a repository to a dedicated user is currently unsupported
Creating a fork using this resource without an organisation will create the fork in the executors name
## Example Usage
```terraform
resource "gitea_org" "org1" {
name = "org1"
}
resource "gitea_org" "org2" {
name = "org2"
}
resource "gitea_repository" "repo1_in_org1" {
username = gitea_org.org1.name
name = "repo1-in-org1"
}
resource "gitea_fork" "user_fork_of_repo1_in_org1" {
owner = gitea_org.org1.name
repo = gitea_repository.repo1_in_org1.name
}
resource "gitea_fork" "org2_fork_of_repo1_in_org1" {
owner = gitea_org.org1.name
repo = gitea_repository.repo1_in_org1.name
organization = gitea_org.org2.name
}
```
<!-- schema generated by tfplugindocs -->
## Schema

@ -2,7 +2,7 @@ terraform {
required_providers {
gitea = {
source = "Lerentis/gitea"
version = "0.8.0"
version = "0.9.0"
}
}
}

@ -8,16 +8,16 @@ resource "gitea_org" "org2" {
resource "gitea_repository" "repo1_in_org1" {
username = gitea_org.org1.name
name = "repo1-in-org1"
name = "repo1-in-org1"
}
resource "gitea_fork" "user_fork_of_repo1_in_org1" {
owner = gitea_org.org1.name
repo = gitea_repository.repo1_in_org1.name
repo = gitea_repository.repo1_in_org1.name
}
resource "gitea_fork" "org2_fork_of_repo1_in_org1" {
owner = gitea_org.org1.name
repo = gitea_repository.repo1_in_org1.name
owner = gitea_org.org1.name
repo = gitea_repository.repo1_in_org1.name
organization = gitea_org.org2.name
}

@ -3,14 +3,15 @@ package gitea
import (
"fmt"
"strconv"
"code.gitea.io/sdk/gitea"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
const (
forkOwner string = "owner"
forkRepo string = "repo"
forkOrganization string = "organization"
forkOwner string = "owner"
forkRepo string = "repo"
forkOrganization string = "organization"
)
func resourceForkCreate(d *schema.ResourceData, meta interface{}) (err error) {
@ -24,8 +25,8 @@ func resourceForkCreate(d *schema.ResourceData, meta interface{}) (err error) {
}
repo, _, err := client.CreateFork(d.Get(forkOwner).(string),
d.Get(forkRepo).(string),
opts)
d.Get(forkRepo).(string),
opts)
if err == nil {
err = setForkResourceData(repo, d)
}
@ -102,6 +103,8 @@ func resourceGiteaFork() *schema.Resource {
Description: "The organization that owns the forked repo",
},
},
Description: "`gitea_fork` manages repository fork",
Description: "`gitea_fork` manages repository fork to the current user or an organisation\n" +
"Forking a repository to a dedicated user is currently unsupported\n" +
"Creating a fork using this resource without an organisation will create the fork in the executors name",
}
}

Loading…
Cancel
Save