mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Provision loadbalancer with terraform and custom scripts
This commit is contained in:
parent
01b7e79e55
commit
77a6ef36f3
8 changed files with 136 additions and 29 deletions
16
terraform/scripts/create_lb.sh
Executable file
16
terraform/scripts/create_lb.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
export TOKEN=`jq '.token' -r ~/.scwrc`
|
||||
REGION="fr-par"
|
||||
ORGANIZATION_ID=`jq '.organization' -r ~/.scwrc`
|
||||
|
||||
LB_NAME=$1
|
||||
LB_IP=$2
|
||||
|
||||
IP_ID=$(http GET "https://api.scaleway.com/lb/v1/regions/$REGION/ips" X-Auth-Token:$TOKEN | jq -r ".ips[] | select(.ip_address == \"$LB_IP\") | .id")
|
||||
echo "IP_ID: $IP_ID"
|
||||
|
||||
http POST "https://api.scaleway.com/lb/v1/regions/$REGION/lbs" X-Auth-Token:$TOKEN name=$LB_NAME organization_id=$ORGANIZATION_ID ip_id=$IP_ID --ignore-stdin | jq -r '.id'
|
||||
Loading…
Add table
Add a link
Reference in a new issue