Since Go CDK does not currently support SQL on Azure for this sample, you must run a local MySQL database while using Azure Storage for the blob and runtimevar APIs.
- Authenticate: Log in via
az login. - Provision: Use Terraform in the
azure directory to create storage resources. - Run locally with Azure storage: Start the local MySQL database, then run the
guestbook binary locally, providing Azure credentials via environment variables (AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY) and the storage container name via the -bucket flag. - Cleanup: Run
terraform destroy in the azure directory.
# Provisioning
az login
cd azure
terraform init
terraform apply -var location="West US"
# Running with Azure Storage
# (In a separate terminal, start local MySQL)
go run localdb/main.go
# In the azure directory
export AZURE_STORAGE_ACCOUNT=<your storage_account>
export AZURE_STORAGE_KEY=<your access_key>
./guestbook -env=azure -bucket=<your storage_container> -motd_var=motd