diff --git a/README.md b/README.md index e94483b..d2f1b50 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,17 @@ mkdir -p ~/.terraform.d/plugins/registry.terraform.io/DevFW-CICD/edge-connect/1. cp terraform-provider-edge-connect ~/.terraform.d/plugins/registry.terraform.io/DevFW-CICD/edge-connect/1.0.0/darwin_arm64/ ``` -> Note: Adjust the path based on your OS and architecture (e.g., `linux_amd64`, `darwin_amd64`, etc.) +Note: Adjust the path based on your OS and architecture (e.g., `linux_amd64`, `darwin_amd64`, etc.) -4. Generate the binary by running `go install .` from the repository root. This installs the provider binary to `$HOME/go/bin` and means that `terraform init` is not necessary. +## Usage -5. You will also need a `~/.terraformrc` file with the following contents. `` should refer to your `$HOME` directory. +### Provider Configuration + +As the provider is currently not officially registered for public download, terraform must be configured to use a locally built version. + +To generate the binary run `go install .` from the repository root. This installs the provider binary to `$HOME/go/bin` and means that `terraform init` is not necessary. + +You will also need a `~/.terraformrc` file with the following contents. `` should refer to your `$HOME` directory. ```hcl provider_installation { @@ -70,11 +76,7 @@ provider_installation { } ``` -## Usage - -### Provider Configuration - -The provider must be configured with credentials and a URL. This can be done with a token in your code: +You can then reference the local provider in your `.tf` files as follows: ```hcl provider "edge-connect" { @@ -83,7 +85,7 @@ provider "edge-connect" { } ``` -Or with basic authentication: +Or using basic authentication: ```hcl provider "edge-connect" { @@ -93,7 +95,7 @@ provider "edge-connect" { } ``` -Or without code changes, via environment variables: +Configuration can also be provided via environment variables: - `EDGE_CONNECT_BASE_URL` - `EDGE_CONNECT_TOKEN` - `EDGE_CONNECT_USERNAME` diff --git a/generate-provider-json.sh b/generate-provider-json.sh index 1cd1124..b2697a0 100755 --- a/generate-provider-json.sh +++ b/generate-provider-json.sh @@ -9,12 +9,15 @@ METADATA_FILE=$2 TERRALIST_API=${TERRALIST_API:-https://terralist.garm-provider-test.t09.de/v1/api} TERRALIST_API_KEY=${TERRALIST_API_KEY:-invalid-key} +env | grep FORGEJO_ || echo "Warning: no FORGEJO_ environment variables found" +env | grep GITHUB_ || echo "Warning: no GITHUB_ environment variables found" + VERSION=$(cat $METADATA_FILE | jq -r '.version') -BASE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download" +BASE_URL="$FORGEJO_SERVER_URL/$FORGEJO_REPOSITORY/releases/download" if ! [[ "$BASE_URL" =~ "terraform" ]]; then - echo "Error: GITHUB_ environment variables not set correctly" >&2 + echo "Error: FORGEJO_ environment variables not set correctly" >&2 exit 1 fi