gcloud auth application-default login
cd ~/gcp-alert-push
cp -R function-src/ function-build/
cd function-build
pip install -r requirement.txt -t .
cd ~/gcp-alert-push
# init terraform dependency
terraform init
# deploy with var parameters
terraform apply --auto-approve -var="project_id=PROJECT_ID" -var="region=REGION" -var="cloudfunctions_source_code_path=SRC_BUILD_PATH" -var="wechat_webhook=URL" -var="dingtalk_webhook=URL"
cd ~/gcp-alert-push
# create var file with like this[ please replace xxx with your's]
cat > testing.tfvars << EOF
project_id = "xxx"
region = "us-central1"
cloudfunctions_source_code_path = "./function-build/"
wechat_webhook="xxx"
dingtalk_webhook="xxx"
EOF
# init terraform dependency
terraform init
# deploy with var file
terraform apply -var-file="testing.tfvars" --auto-approve
terraform destroy --auto-approve