Baseline Environment in CDK for Terraform using TypeScript
STACKS="Azurerm-Ai-Stack Azurerm-App-Stack Azurerm-Data-Stack Azurerm-Iot-Stack Azurerm-Monitoring-Stack Azurerm-Security-Stack"
# Set the Azure subscription ID
export ARM_SUBSCRIPTION_ID=$(az account show --query id --output tsv)
# Perform a diff to see what will be deployed
cdktf diff Azurerm-Ai-Stack
# Deploy the stack
cdktf deploy --auto-approve Azurerm-Ai-Stack
# Destroy the stack
cdktf destroy --auto-approve Azurerm-Ai-Stack
To use a remote backend, you need to set up a storage account and a container in Azure.
Then, you can select the backend configurations by setting the TF_BACKEND
environment variable such as azurerm
or local
. The actual implementation of the backend is in the lib/utils.ts file.
For example, to use the remote backend, you can run the following command:
# Deploy all the stacks with remote backend
make deploy TF_BACKEND=azurerm