Initial revision
This commit is contained in:
11
scripts/download_plugin.sh
Executable file
11
scripts/download_plugin.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -ue
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
RELEASE_URL=$(curl -s https://api.github.com/repos/form3tech-oss/vault-plugin-secrets-grafanacloud/releases/latest | \
|
||||
jq --raw-output '.assets[] | select(.content_type=="application/octet-stream") | .browser_download_url')
|
||||
|
||||
PLUGIN=$SCRIPT_DIR/../plugins/vault-plugin-secrets-grafanacloud
|
||||
curl -L -o $PLUGIN $RELEASE_URL
|
||||
chmod +x $PLUGIN
|
||||
9
scripts/read_role_cred.sh
Executable file
9
scripts/read_role_cred.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -ue
|
||||
|
||||
vault write grafanacloud/roles/examplerole \
|
||||
gc_role="Viewer" \
|
||||
ttl="60s" \
|
||||
max_ttl="600s"
|
||||
|
||||
vault read grafanacloud/creds/examplerole
|
||||
4
scripts/revoke_all_leases.sh
Executable file
4
scripts/revoke_all_leases.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -ue
|
||||
|
||||
vault lease revoke -prefix grafanacloud/creds
|
||||
21
scripts/write_grafana_config.sh
Executable file
21
scripts/write_grafana_config.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [[ -z "$GRAFANA_ORG" ]]; then
|
||||
echo "Must provide GRAFANA_ORG in environment" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$GRAFANA_ADMIN_TOKEN" ]]; then
|
||||
echo "Must provide GRAFANA_ADMIN_TOKEN in environment" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
vault secrets enable -path=grafanacloud vault-plugin-secrets-grafanacloud
|
||||
|
||||
vault write grafanacloud/config \
|
||||
organisation=$GRAFANA_ORG \
|
||||
key=$GRAFANA_ADMIN_TOKEN \
|
||||
ttl=300 \
|
||||
max_ttl=3600 \
|
||||
url=https://grafana.com/api/
|
||||
Reference in New Issue
Block a user