From 2b10d829d8de45098175ecec441fefdb4ed5c16d Mon Sep 17 00:00:00 2001 From: Dennis Kniep Date: Thu, 9 Jan 2025 01:26:21 +0100 Subject: [PATCH] docs: Custom Terraform Provider Signed-off-by: Dennis Kniep --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0e6ce7..021e59a 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,42 @@ Build binary: make build ``` -## Regression Tests +### Custom Terraform Provider + +If you want to build this crossplane provider on top of a forked `terraform-provider-keycloak` follow these instructions: + +1. Execute code generation: +``` +TERRAFORM_PROVIDER_REPO=https://github.com//terraform-provider-keycloak \ +TERRAFORM_PROVIDER_VERSION=1.0.0 \ +make generate +``` +**Hint:** `TERRAFORM_PROVIDER_VERSION` must be a Release. Releases can be found here: `https://github.com//terraform-provider-keycloak/releases`. +Every ReleaseName should have the prefix "v" (i.e 'v1.0.0'). But if you specify the `TERRAFORM_PROVIDER_VERSION` you need to +skip that prefix (i.e. '1.0.0') + +2. Use forked repo as go dependency: +``` +go mod edit -replace="github.com/keycloak/terraform-provider-keycloak@v0.0.0-20241206084240-f87470c95855=github.com//terraform-provider-keycloak@v1.0.0" +go mod tidy +``` +**Hint:** You can also specify the version as `github.com//terraform-provider-keycloak@v0.0.0--` + +3. Build and publish to custom repo + +If you want to build and publish with CI, then add following to [GithubRepo > Settings > Secrets and variables > Actions](https://github.com/denniskniep/provider-keycloak/settings/secrets/actions) + +Variables > Repository variables +* TERRAFORM_PROVIDER_REPO=https://github.com//terraform-provider-keycloak +* TERRAFORM_PROVIDER_VERSION=1.0.0 +* UPBOUND_MARKETPLACE_PUSH_ROBOT_USR= +* XPKG_REG_ORGS=xpkg.upbound.io/ +* XPKG_REG_ORGS_NO_PROMOTE=xpkg.upbound.io/ + +Secrets > Repository secrets +* UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW= + +## Regression Tests TODO: Add regression test docs ## Report a Bug