From 8095c2a5131ca85daefae64393a0c360a7ab34c3 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Wed, 4 Jan 2023 19:15:00 +0100 Subject: [PATCH] prepare next release --- Makefile | 2 +- README.md | 2 +- docs/resources/repository_key.md | 9 +++++++ examples/provider.tf | 2 +- .../gitea_repository_key/resource.tf | 25 +++++++++++++++++++ gitea/resource_gitea_repository_key.go | 4 +-- 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 examples/resources/gitea_repository_key/resource.tf diff --git a/Makefile b/Makefile index 3ed848f..ff74bdc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) GOFMT ?= gofmt -s -VERSION = 0.11.2 +VERSION = 0.12.0 test: fmt-check go test -i $(TEST) || exit 1 diff --git a/README.md b/README.md index 458f843..c51c1ef 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.11.2" + version = "0.12.0" } } } diff --git a/docs/resources/repository_key.md b/docs/resources/repository_key.md index 8171b97..aef33dd 100644 --- a/docs/resources/repository_key.md +++ b/docs/resources/repository_key.md @@ -16,6 +16,15 @@ Every key needs a unique name and unique key, i.e. no key can be added twice to ## Example Usage ```terraform +terraform { + required_providers { + tls = { + source = "hashicorp/tls" + version = "4.0.4" + } + } +} + resource "tls_private_key" "example" { type = "RSA" rsa_bits = 4096 diff --git a/examples/provider.tf b/examples/provider.tf index 23098f8..c26374e 100644 --- a/examples/provider.tf +++ b/examples/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { gitea = { source = "terraform.local/lerentis/gitea" - version = "0.11.2" + version = "0.12.0" } } } diff --git a/examples/resources/gitea_repository_key/resource.tf b/examples/resources/gitea_repository_key/resource.tf new file mode 100644 index 0000000..c8a6f4a --- /dev/null +++ b/examples/resources/gitea_repository_key/resource.tf @@ -0,0 +1,25 @@ +terraform { + required_providers { + tls = { + source = "hashicorp/tls" + version = "4.0.4" + } + } +} + +resource "tls_private_key" "example" { + type = "RSA" + rsa_bits = 4096 +} + +resource "gitea_repository" "example" { + name = "example" + private = true +} + +resource "gitea_repository_key" "example" { + repository = gitea_repository.example.id + title = "Example Deploy Key" + read_only = true + key = tls_private_key.example.public_key_openssh +} \ No newline at end of file diff --git a/gitea/resource_gitea_repository_key.go b/gitea/resource_gitea_repository_key.go index e7482d0..69cb863 100644 --- a/gitea/resource_gitea_repository_key.go +++ b/gitea/resource_gitea_repository_key.go @@ -24,11 +24,11 @@ func resourceRepoKeyIdParts(d *schema.ResourceData) (bool, int64, int64, error) repoId, err := strconv.ParseInt(parts[0], 10, 64) if err != nil { - return true, 0, 0, err + return false, 0, 0, err } keyId, err := strconv.ParseInt(parts[1], 10, 64) if err != nil { - return true, 0, 0, err + return false, 0, 0, err } return true, repoId, keyId, err }