home-cloud/Makefile

31 lines
841 B
Makefile
Raw Normal View History

2019-01-30 19:49:47 +01:00
TF=terraform
TFFLAGS=-var-file=credentials.tfvars
VALIDATE=terraform validate -check-variables=false
apply: init
$(TF) apply $(TFFLAGS)
plan: init
$(TF) plan $(TFFLAGS)
destroy: init
$(TF) destroy $(TFFLAGS)
lint: init
$(VALIDATE) modules/docker_node
$(VALIDATE) modules/floating_ip
$(VALIDATE) services/bitwarden
$(VALIDATE) .
2020-04-04 23:23:13 +02:00
init: keys/id_terraform
2019-01-30 19:49:47 +01:00
$(TF) init
2020-04-04 23:23:13 +02:00
keys/id_terraform:
2019-01-30 19:49:47 +01:00
echo "No private key found! Generating Terraform SSH Keys."
2020-04-04 23:23:13 +02:00
./scripts/bootstrap-keys.sh
kubeconfig: keys/id_terraform
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i keys/id_terraform root@`terraform output cluster_public_ip`:/etc/rancher/k3s/k3s.yaml ./kubeconfig.yaml
sed -i "s/127.0.0.1/`terraform output cluster_public_ip`/g" ./kubeconfig.yaml
sed -i "s/default/`terraform output cluster_name`/g" ./kubeconfig.yaml