Skip to content

Commit cc8760c

Browse files
techknowlogickLerentis
andcommitted
lerentis's changes (#12)
Changes from lerentis's fork. Co-authored-by: Tobias Trabelsi <[email protected]> Reviewed-on: https://gitea.com/gitea/terraform-provider-gitea/pulls/12
1 parent 107e741 commit cc8760c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1884
-414
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to improve the provider
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
**Expected behavior**
16+
A clear and concise description of what you expected to happen.
17+
18+
**Log Output**
19+
If applicable, add logs to help explain your problem.
20+
21+
**Additional Data**
22+
Important for reproducability.
23+
24+
- Terraform Version
25+
26+
- Operating System
27+
28+
- Provider Version
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this provider
4+
title: ''
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2-
dist/
1+
.vscode
2+
dist/

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 lerentis, https://git.uploadfilter24.eu/lerentis
4+
Copyright (c) 2022 The Gitea Authors
5+
6+
Permission is hereby granted, free of charge, to any person obtaining
7+
a copy of this software and associated documentation files (the
8+
"Software"), to deal in the Software without restriction, including
9+
without limitation the rights to use, copy, modify, merge, publish,
10+
distribute, sublicense, and/or sell copies of the Software, and to
11+
permit persons to whom the Software is furnished to do so, subject to
12+
the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
TEST?=./gitea
22
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
3-
43
GOFMT ?= gofmt -s
54

6-
VERSION = 0.6.1
5+
VERSION = 0.2.0
76

87
test: fmt-check
98
go test -i $(TEST) || exit 1
@@ -31,11 +30,6 @@ fmt-check:
3130
exit 1; \
3231
fi;
3332
build:
34-
go build -o terraform-provider-gitea_${VERSION}
35-
install: build
36-
@echo installing to
37-
@echo ~/.terraform.d/plugins/terraform.local/local/gitea/${VERSION}/linux_amd64/terraform-provider-gitea_${VERSION}
38-
@mkdir -p ~/.terraform.d/plugins/terraform.local/local/gitea/${VERSION}/linux_amd64
39-
@mv terraform-provider-gitea_${VERSION} ~/.terraform.d/plugins/terraform.local/local/gitea/${VERSION}/linux_amd64/terraform-provider-gitea_${VERSION}
33+
go build -ldflags="-X 'main.Version=${VERSION}'" -o terraform-provider-gitea_${VERSION}
4034
doc:
41-
tfplugindocs
35+
tfplugindocs

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
11
# terraform-provider-gitea
22

33
Terraform Gitea Provider
4+
5+
This repo is mirrored from https://gitea.com/gitea/terraform-provider-gitea please send all issues and pull requests there.
6+
7+
## Usage
8+
9+
This is not a 1.0 release, so usage is subject to change!
10+
11+
```terraform
12+
terraform {
13+
required_providers {
14+
gitea = {
15+
source = "go-gitea/gitea"
16+
version = "0.2.0"
17+
}
18+
}
19+
}
20+
21+
provider "gitea" {
22+
base_url = var.gitea_url # optionally use GITEA_BASE_URL env var
23+
token = var.gitea_token # optionally use GITEA_TOKEN env var
24+
25+
# Username/Password authentication is mutally exclusive with token authentication
26+
# username = var.username # optionally use GITEA_USERNAME env var
27+
# password = var.password # optionally use GITEA_PASSWORD env var
28+
29+
# A file containing the ca certificate to use in case ssl certificate is not from a standard chain
30+
cacert_file = var.cacert_file
31+
32+
# If you are running a gitea instance with self signed TLS certificates
33+
# and you want to disable certificate validation you can deactivate it with this flag
34+
insecure = false
35+
}
36+
37+
resource "gitea_repository" "test" {
38+
username = "lerentis"
39+
name = "test"
40+
private = true
41+
issue_labels = "Default"
42+
license = "MIT"
43+
gitignores = "Go"
44+
}
45+
46+
resource "gitea_repository" "mirror" {
47+
username = "lerentis"
48+
name = "terraform-provider-gitea-mirror"
49+
description = "Mirror of Terraform Provider"
50+
mirror = true
51+
migration_clone_addresse = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git"
52+
migration_service = "gitea"
53+
migration_service_auth_token = var.gitea_mirror_token
54+
}
55+
56+
resource "gitea_org" "test_org" {
57+
name = "test-org"
58+
}
59+
60+
resource "gitea_repository" "org_repo" {
61+
username = gitea_org.test_org.name
62+
name = "org-test-repo"
63+
}
64+
65+
```
66+
67+
## License
68+
69+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
70+
71+
## History
72+
73+
This codebase was created at https://gitea.com/gitea/terraform-provider-gitea, was forked by @lerentis, and then their changes were merged back into the original repo. Thank you to everyone who contributed!
74+

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ description: |-
1616
terraform {
1717
required_providers {
1818
gitea = {
19-
source = "gitea/gitea"
20-
version = "0.6.1"
19+
source = "go-gitea/gitea"
20+
version = "0.1.0"
2121
}
2222
}
2323
}

docs/resources/fork.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "gitea_fork Resource - terraform-provider-gitea"
4+
subcategory: ""
5+
description: |-
6+
gitea_fork manages repository fork to the current user or an organisation
7+
Forking a repository to a dedicated user is currently unsupported
8+
Creating a fork using this resource without an organisation will create the fork in the executors name
9+
---
10+
11+
# gitea_fork (Resource)
12+
13+
`gitea_fork` manages repository fork to the current user or an organisation
14+
Forking a repository to a dedicated user is currently unsupported
15+
Creating a fork using this resource without an organisation will create the fork in the executors name
16+
17+
## Example Usage
18+
19+
```terraform
20+
resource "gitea_org" "org1" {
21+
name = "org1"
22+
}
23+
24+
resource "gitea_org" "org2" {
25+
name = "org2"
26+
}
27+
28+
resource "gitea_repository" "repo1_in_org1" {
29+
username = gitea_org.org1.name
30+
name = "repo1-in-org1"
31+
}
32+
33+
resource "gitea_fork" "user_fork_of_repo1_in_org1" {
34+
owner = gitea_org.org1.name
35+
repo = gitea_repository.repo1_in_org1.name
36+
}
37+
38+
resource "gitea_fork" "org2_fork_of_repo1_in_org1" {
39+
owner = gitea_org.org1.name
40+
repo = gitea_repository.repo1_in_org1.name
41+
organization = gitea_org.org2.name
42+
}
43+
```
44+
45+
<!-- schema generated by tfplugindocs -->
46+
## Schema
47+
48+
### Required
49+
50+
- `owner` (String) The owner or owning organization of the repository to fork
51+
- `repo` (String) The name of the repository to fork
52+
53+
### Optional
54+
55+
- `organization` (String) The organization that owns the forked repo
56+
57+
### Read-Only
58+
59+
- `id` (String) The ID of this resource.
60+
61+

docs/resources/git_hook.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "gitea_git_hook Resource - terraform-provider-gitea"
4+
subcategory: ""
5+
description: |-
6+
gitea_git_hook manages git hooks on a repository.
7+
import is currently not supported
8+
WARNING: using this resource requires to enable server side hookswhich are known to cause security issues https://github.com/go-gitea/gitea/pull/13058!
9+
if you want to procede, you need to enable server side hooks as stated here https://docs.gitea.io/en-us/config-cheat-sheet/#security-security
10+
---
11+
12+
# gitea_git_hook (Resource)
13+
14+
`gitea_git_hook` manages git hooks on a repository.
15+
import is currently not supported
16+
17+
WARNING: using this resource requires to enable server side hookswhich are known to cause [security issues](https://github.com/go-gitea/gitea/pull/13058)!
18+
19+
if you want to procede, you need to enable server side hooks as stated [here](https://docs.gitea.io/en-us/config-cheat-sheet/#security-security)
20+
21+
## Example Usage
22+
23+
```terraform
24+
resource "gitea_org" "test_org" {
25+
name = "test-org"
26+
}
27+
28+
resource "gitea_repository" "org_repo" {
29+
username = gitea_org.test_org.name
30+
name = "org-test-repo"
31+
}
32+
33+
resource "gitea_git_hook" "org_repo_post_receive" {
34+
name = "post-receive"
35+
user = gitea_org.test_org.name
36+
repo = gitea_repository.org_repo.name
37+
content = file("${path.module}/post-receive.sh")
38+
}
39+
```
40+
41+
<!-- schema generated by tfplugindocs -->
42+
## Schema
43+
44+
### Required
45+
46+
- `content` (String) Content of the git hook
47+
- `name` (String) Name of the git hook to configure
48+
- `repo` (String) The repository that this hook belongs too.
49+
- `user` (String) The user (or organisation) owning the repo this hook belongs too
50+
51+
### Read-Only
52+
53+
- `id` (String) The ID of this resource.
54+
55+

docs/resources/oauth2_app.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Handling [gitea oauth application](https://docs.gitea.io/en-us/oauth2-provider/)
2020
- `name` (String) OAuth Application name
2121
- `redirect_uris` (Set of String) Accepted redirect URIs
2222

23+
### Optional
24+
25+
- `confidential_client` (Boolean) If set to false, it will be a public client (PKCE will be required)
26+
2327
### Read-Only
2428

2529
- `client_id` (String) OAuth2 Application client id

0 commit comments

Comments
 (0)