Compare commits
No commits in common. "main" and "v0.0.1" have entirely different histories.
5 changed files with 25 additions and 89 deletions
10
.github/workflows/release.yaml
vendored
10
.github/workflows/release.yaml
vendored
|
|
@ -26,19 +26,9 @@ jobs:
|
|||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- name: Run GoReleaser
|
||||
id: goreleaser
|
||||
uses: https://github.com/goreleaser/goreleaser-action@v6
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
|
||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||
with:
|
||||
args: release --clean
|
||||
|
||||
- name: Generate and upload provider.json
|
||||
run: |
|
||||
echo '${{steps.goreleaser.outputs.artifacts}}' >artifacts.json
|
||||
echo '${{steps.goreleaser.outputs.metadata}}' >metadata.json
|
||||
./generate-provider-json.sh artifacts.json metadata.json
|
||||
env:
|
||||
TERRALIST_API: https://terralist.garm-provider-test.t09.de/v1/api
|
||||
TERRALIST_API_KEY: ${{ secrets.TERRALIST_API_KEY }}
|
||||
|
|
|
|||
|
|
@ -17,15 +17,19 @@ builds:
|
|||
- arm64
|
||||
|
||||
archives:
|
||||
- formats: ["zip"]
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||
|
||||
checksum:
|
||||
extra_files:
|
||||
- glob: "terraform-registry-manifest.json"
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
|
||||
algorithm: sha256
|
||||
- formats: [tar.gz]
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
formats: [zip]
|
||||
|
||||
signs:
|
||||
- artifacts: checksum
|
||||
|
|
@ -64,9 +68,6 @@ release:
|
|||
gitea:
|
||||
owner: DevFW-CICD
|
||||
name: terraform-provider-edge-connect
|
||||
extra_files:
|
||||
- glob: 'terraform-registry-manifest.json'
|
||||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
||||
|
||||
force_token: gitea
|
||||
gitea_urls:
|
||||
|
|
|
|||
22
README.md
22
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. `<home>` 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. `<home>` 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`
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
# This script generates and uploads a terraform provider.json file and uploads it to Terralist
|
||||
|
||||
ARTIFACTS_FILE=$1
|
||||
METADATA_FILE=$2
|
||||
|
||||
TERRALIST_API=${TERRALIST_API:-https://terralist.garm-provider-test.t09.de/v1/api}
|
||||
TERRALIST_API_KEY=${TERRALIST_API_KEY:-invalid-key}
|
||||
|
||||
VERSION=$(cat $METADATA_FILE | jq -r '.version')
|
||||
|
||||
BASE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download"
|
||||
|
||||
if ! [[ "$BASE_URL" =~ "terraform" ]]; then
|
||||
echo "Error: GITHUB_ environment variables not set correctly" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq --arg base_url "$BASE_URL" --arg version "$VERSION" '
|
||||
{
|
||||
protocols: ["6"],
|
||||
|
||||
shasums: (
|
||||
{
|
||||
url: ($base_url + "/v" + $version + "/" + (.[]
|
||||
| select(.type=="Checksum").name)),
|
||||
signature_url: ($base_url + "/v" + $version + "/" + (.[]
|
||||
| select(.type=="Signature").name))
|
||||
}
|
||||
),
|
||||
|
||||
platforms: [
|
||||
.[]
|
||||
| select(.type=="Archive")
|
||||
| {
|
||||
os: .goos,
|
||||
arch: .goarch,
|
||||
download_url: ($base_url + "/v" + $version + "/" + .name),
|
||||
shasum: (.extra.Checksum | sub("^sha256:";""))
|
||||
}
|
||||
]
|
||||
}
|
||||
' $ARTIFACTS_FILE >./provider.json
|
||||
|
||||
cat provider.json | jq .
|
||||
|
||||
curl -X POST $TERRALIST_API/providers/edge-connect/${VERSION}/upload \
|
||||
-H "Authorization: Bearer x-api-key:$TERRALIST_API_KEY" \
|
||||
-d "$(cat ./provider.json)"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"metadata": {
|
||||
"protocol_versions": ["6.0"]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue