Compare commits

..

No commits in common. "ed32470b1754b17342e1db20b666124d9c9441e9" and "48f5c3ee3ccbfc6e22155eda94a562485b39aade" have entirely different histories.

8 changed files with 9 additions and 60 deletions

View File

@ -5,7 +5,7 @@ KERNEL?=$$(uname -s | tr '[:upper:]' '[:lower:]')
GOFMT ?= gofmt -s
VERSION = 0.15.0
VERSION = 0.14.1
test: fmt-check
go test -i $(TEST) || exit 1

View File

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

View File

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

View File

@ -46,6 +46,5 @@ resource "gitea_repository" "org_repo" {
- `avatar_url` (String)
- `id` (String) The ID of this resource.
- `repos` (List of String) List of all Repositories that are part of this organisation

View File

@ -123,15 +123,3 @@ output "token" {
value = resource.gitea_token.test_token.token
sensitive = true
}
data "gitea_repo" "org_repos" {
name = each.key
username = gitea_org.org1.name
for_each = {
for repo in resource.gitea_org.org1.repos : repo => repo
}
}
output "repos" {
value = data.gitea_repo.org_repos["repo1-in-org1"].clone_url
}

View File

@ -2,7 +2,7 @@ terraform {
required_providers {
gitea = {
source = "terraform.local/lerentis/gitea"
version = "0.15.0"
version = "0.14.1"
}
}
}

View File

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

View File

@ -16,7 +16,6 @@ const (
orgLocation string = "location"
orgVisibility string = "visibility"
RepoAdminChangeTeamAccess string = "repo_admin_change_team_access"
orgRepos string = "org_repos"
)
// might come in handy if we want to stick to numeric IDs
@ -49,32 +48,6 @@ func searchOrgByClientId(c *gitea.Client, id int64) (res *gitea.Organization, er
}
}
func getAllOrgRepos(c *gitea.Client, orgName string) (repos []string, err error) {
page := 1
for {
repoBuffer, _, err := c.ListOrgRepos(orgName, gitea.ListOrgReposOptions{
ListOptions: gitea.ListOptions{
Page: page,
PageSize: 50,
},
})
if err != nil {
return nil, err
}
if len(repoBuffer) == 0 {
return repos, nil
}
for _, repo := range repoBuffer {
repos = append(repos, repo.Name)
}
page += 1
}
}
func resourceOrgRead(d *schema.ResourceData, meta interface{}) (err error) {
client := meta.(*gitea.Client)
@ -89,8 +62,7 @@ func resourceOrgRead(d *schema.ResourceData, meta interface{}) (err error) {
return nil
}
repos, _ := getAllOrgRepos(client, org.UserName)
err = setOrgResourceData(org, d, &repos)
err = setOrgResourceData(org, d)
return
}
@ -113,8 +85,7 @@ func resourceOrgCreate(d *schema.ResourceData, meta interface{}) (err error) {
return
}
repos, _ := getAllOrgRepos(client, org.UserName)
err = setOrgResourceData(org, d, &repos)
err = setOrgResourceData(org, d)
return
}
@ -147,8 +118,7 @@ func resourceOrgUpdate(d *schema.ResourceData, meta interface{}) (err error) {
org, resp, err = client.GetOrg(d.Get(orgName).(string))
repos, _ := getAllOrgRepos(client, org.UserName)
err = setOrgResourceData(org, d, &repos)
err = setOrgResourceData(org, d)
return
}
@ -171,7 +141,7 @@ func resourceOrgDelete(d *schema.ResourceData, meta interface{}) (err error) {
return
}
func setOrgResourceData(org *gitea.Organization, d *schema.ResourceData, repos *[]string) (err error) {
func setOrgResourceData(org *gitea.Organization, d *schema.ResourceData) (err error) {
d.SetId(fmt.Sprintf("%d", org.ID))
d.Set("name", org.UserName)
d.Set("full_name", org.FullName)
@ -180,7 +150,6 @@ func setOrgResourceData(org *gitea.Organization, d *schema.ResourceData, repos *
d.Set("website", org.Website)
d.Set("location", org.Location)
d.Set("visibility", org.Visibility)
d.Set("repos", repos)
return
}
@ -242,13 +211,6 @@ func resourceGiteaOrg() *schema.Resource {
Default: "public",
Description: "Flag is this organisation should be publicly visible or not.",
},
"repos": {
Type: schema.TypeList,
Required: false,
Computed: true,
Description: "List of all Repositories that are part of this organisation",
Elem: &schema.Schema{Type: schema.TypeString},
},
},
Description: "`gitea_org` manages a gitea organisation.\n\n" +
"Organisations are a way to group repositories and abstract permission management in a gitea instance.",