From c183098b7daab4a84b796d797dfedf199bd8a299 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Wed, 17 Aug 2022 21:58:02 +0200 Subject: [PATCH] fixed faulty import of repository --- Makefile | 2 +- README.md | 2 +- examples/provider.tf | 2 +- examples/provider/provider.tf | 2 +- gitea/resource_gitea_repository.go | 7 ++++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 790ac6a..e97dee5 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) GOFMT ?= gofmt -s -VERSION = 0.7.3 +VERSION = 0.7.4 test: fmt-check go test -i $(TEST) || exit 1 diff --git a/README.md b/README.md index 193de99..9777a48 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.7.3" + version = "0.7.4" } } } diff --git a/examples/provider.tf b/examples/provider.tf index ec315cc..d578540 100644 --- a/examples/provider.tf +++ b/examples/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { gitea = { source = "terraform.local/lerentis/gitea" - version = "0.8.0" + version = "0.7.4" } } } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 4e8d17a..45582f9 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.7.2" + version = "0.7.4" } } } diff --git a/gitea/resource_gitea_repository.go b/gitea/resource_gitea_repository.go index 6436fcd..f4e9ff5 100644 --- a/gitea/resource_gitea_repository.go +++ b/gitea/resource_gitea_repository.go @@ -232,6 +232,7 @@ func respurceRepoDelete(d *schema.ResourceData, meta interface{}) (err error) { func setRepoResourceData(repo *gitea.Repository, d *schema.ResourceData) (err error) { d.SetId(fmt.Sprintf("%d", repo.ID)) + d.Set("username", repo.Owner.UserName) d.Set("name", repo.Name) d.Set("description", repo.Description) d.Set("full_name", repo.FullName) @@ -248,8 +249,8 @@ func setRepoResourceData(repo *gitea.Repository, d *schema.ResourceData) (err er d.Set("watchers", repo.Watchers) d.Set("open_issue_count", repo.OpenIssues) d.Set("default_branch", repo.DefaultBranch) - d.Set("created", repo.Created) - d.Set("updated", repo.Updated) + d.Set("created", repo.Created.String()) + d.Set("updated", repo.Updated.String()) d.Set("permission_admin", repo.Permissions.Admin) d.Set("permission_push", repo.Permissions.Push) d.Set("permission_pull", repo.Permissions.Pull) @@ -264,7 +265,7 @@ func resourceGiteaRepository() *schema.Resource { Update: resourceRepoUpdate, Delete: respurceRepoDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, }, Schema: map[string]*schema.Schema{ "username": {