### Planning Terraform with Example Vars Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/networking/express_routes/README.md Shows an example of running a `terraform plan` command, specifically targeting a configuration file located within an 'examples' subdirectory, likely for testing a specific module configuration like express routes. ```bash sudo terraform plan -var-file examples/networking/express_routes/configuration.tfvars ``` -------------------------------- ### Initializing and Running Terraform Module Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/networking/express_routes/README.md Demonstrates how to initialize a Terraform module and then execute plan, apply, or destroy commands, passing multiple variable files. This allows testing the module independently without a full landing zone setup. ```bash sudo terraform init terraform [plan|apply|destroy] \ -var-file ../configuration.tfvars \ -var-file ../keyvaults.tfvars \ -var-file ../nsg_definitions.tfvars \ -var-file ../virtual_networks.tfvars \ -var-file ../public_ip_addresses.tfvars \ -var-file ../virtual_machines.tfvars ``` -------------------------------- ### Plan Terraform with Specific Example Var File - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/networking/private_links/endpoints/static_ip/README.md Illustrates how to execute a Terraform plan operation using a single, specific variable file located within an example directory. This is useful for testing the module with pre-defined configurations from examples. Requires `terraform` to be installed. ```bash sudo terraform plan -var-file examples/networking/private_endpoint/configuration.tfvars ``` -------------------------------- ### Managing CAF Example with Rover (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/README.md Explains the Bash command for using the `rover` tool to manage a specific CAF example landing zone. It requires specifying the landing zone path and the variable folder containing the example's configuration. Users can choose between `-a plan` to preview changes or `-a apply` to deploy the resources defined in the example. ```bash rover -lz /tf/caf/landingzones/caf_example \ -var-folder /tf/caf/examples/ \ -a plan|apply ``` -------------------------------- ### Running Terraform Example with Standard Commands Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/modules/databases/database_migration_service/README.md This Bash script provides instructions on how to run the provided example configuration using standard Terraform commands. It includes steps for logging into Azure, changing directory to the examples, initializing Terraform, and executing plan, apply, or destroy commands with a specific variable file. ```bash #Login to your Azure subscription az login #Run the example cd /tf/caf/examples terraform init terraform [plan | apply | destroy] \ -var-file ../modules/databases/database_migration_service/examples/100-dms/configuration.tfvars ``` -------------------------------- ### Deploying WVD Example with Rover Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/azure_virtual_desktop/wvd_resources/README.md This Bash command shows how to use the `rover` tool to manage the lifecycle (plan, apply, or destroy) of the Windows Virtual Desktop example deployment. It references specific paths for the landing zone, variable files, deployment level, and the target Terraform state file. This requires the `rover` environment and the specified paths for the example configuration. ```bash rover \ -lz /tf/caf/landingzones/caf_example \ -var-folder /tf/caf/examples/compute/wvd_resources \ -level level1 \ -tfstate wvd-pre.tfstate \ -a [plan | apply | destroy] ``` -------------------------------- ### Running Example with Rover Tool (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/consumption_budget/README.md Provides instructions for deploying the example consumption budget using the rover command-line tool, which is part of the Cloud Adoption Framework tooling. Specifies the landing zone directory, variable folder, level, and action (plan, apply, or destroy). ```Bash rover \ -lz /tf/caf/examples \ -var-folder /tf/caf/examples/consumption_budget/102-consumption-budget-rg-alerts/ \ -level level1 \ -a [plan | apply | destroy] ``` -------------------------------- ### Running Example with Terraform CLI (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/consumption_budget/README.md Provides step-by-step instructions to deploy the example consumption budget using the standard Terraform command-line interface. Includes commands for Azure login, navigating directories, initialization, planning, applying, and destroying resources using a specific variable file. ```Bash #Login to your Azure subscription az login #Run the example cd /tf/caf/examples terraform init terraform [plan | apply | destroy] \ -var-file ./consumption_budget/102-consumption-budget-rg-alerts/configuration.tfvars ``` -------------------------------- ### Running Example with Rover Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/database_migration_services/README.md Describes how to use the rover command to deploy the example scenario for Azure Database Migration Services. It specifies the landing zone directory, variable folder, deployment level, and action (plan, apply, or destroy). ```Bash rover \ -lz /tf/caf/examples \ -var-folder ../modules/databases/database_migration_service/examples/100-dms \ -level level1 \ -a [plan | apply | destroy] ``` -------------------------------- ### Running Terraform Example Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/database_migration_services/README.md Provides the necessary Bash commands to log in to Azure, navigate to the example directory, initialize Terraform, and execute plan, apply, or destroy operations using a specific variable file. ```Bash #Login to your Azure subscription az login #Run the example cd /tf/caf/examples terraform init terraform [plan | apply | destroy] \ -var-file ../modules/databases/database_migration_service/examples/100-dms/configuration.tfvars ``` -------------------------------- ### Starting Systemd Service (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md Starts a specific systemd service for a rover agent. This command activates the service unit, which typically initiates the associated Docker container as defined in the service file. ```bash sudo systemctl start rover-agent-azdo-level0-1.service ``` -------------------------------- ### Running AKS example with standard Terraform commands (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/kubernetes_services/README.md This Bash script provides the necessary commands to execute a specific AKS example scenario using the standard Terraform workflow. It involves authenticating with Azure using `az login`, navigating to the example directory, initializing the Terraform workspace, and then applying, planning, or destroying the infrastructure using specified variable files. ```Bash #Login to your Azure subscription az login #Run the example cd /tf/caf/examples/compute/kubernetes_services/101-single-cluster/standalone terraform init terraform [plan | apply | destroy] \ -var-file ../aks.tfvars \ -var-file ../networking.tfvars ``` -------------------------------- ### Planning Terraform with Default Vars Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/networking/express_routes/README.md Provides a basic example of executing a `terraform plan` command using a single variable file named 'configuration.tfvars' located in the current or parent directory, commonly used for simpler test cases. ```bash sudo terraform plan -var-file configuration.tfvars ``` -------------------------------- ### Running Terraform Example Deployment (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/managed_service_identity/README.md This Bash script provides commands to log in to Azure using the Azure CLI and then execute a Terraform example deployment. It includes steps for initializing Terraform, and running plan, apply, or destroy commands using a specific variable file. ```Bash #Login to your Azure subscription az login #Run the example cd /tf/caf/examples terraform init terraform [plan | apply | destroy] \ -var-file ./managed_service_identity/100-msi-levels/configuration.tfvars ``` -------------------------------- ### Running Rover Example Deployment (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/managed_service_identity/README.md This Bash command demonstrates how to run the example deployment using the rover tool. It requires the launchpad to be deployed first. The command specifies the landing zone path, variable folder, desired deployment level, and the action (plan, apply, or destroy). ```Bash rover \ -lz /tf/caf/examples \ -var-folder /tf/caf/examples/managed_service_identity/100-msi-levels/ \ -level level1 \ -a [plan | apply | destroy] ``` -------------------------------- ### Running Terraform Example with Rover Tool Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/modules/databases/database_migration_service/README.md This Bash script shows how to execute the Terraform example configuration using the `rover` tool. It specifies the landing zone path, variable folder, desired level, and the action to perform (plan, apply, or destroy), providing an alternative execution method common in the Cloud Adoption Framework context. ```bash rover \ -lz /tf/caf/examples \ -var-folder ../modules/databases/database_migration_service/examples/100-dms \ -level level1 \ -a [plan | apply | destroy] ``` -------------------------------- ### Running Azure CAF WVD Example with Rover in Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/azure_virtual_desktop/wvd_resources_and_session_host/README.md This bash command demonstrates how to use the `rover` tool to execute the Terraform example for deploying WVD resources. It specifies the landing zone path, variable folder, level, state file name, and the desired action (plan, apply, or destroy). ```bash rover \ -lz /tf/caf/landingzones/caf_example \ -var-folder /tf/caf/examples/compute/wvd_resources \ -level level1 \ -tfstate wvd-pre.tfstate \ -a [plan | apply | destroy] ``` -------------------------------- ### Running AKS example with rover tool (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/kubernetes_services/README.md This Bash command demonstrates how to deploy an AKS example scenario using the `rover` command-line tool, commonly used within the Cloud Adoption Framework methodology. It specifies the landing zone path, the variable folder location, the execution level, and the desired action (plan, apply, or destroy). This method requires the CAF launchpad to be deployed beforehand. ```Bash rover \ -lz /tf/caf/landingzones/caf_example \ -var-folder /tf/caf/modules/aks/examples/101-single-cluster/ \ -level level1 \ -a [plan | apply | destroy] ``` -------------------------------- ### Connecting to Azure VPN Gateway via OpenVPN - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md This Bash script connects the local environment to the Azure VPN Gateway using OpenVPN. It downloads the VPN client profile via Azure CLI, extracts it, sets up the `tun` network device if needed, starts the OpenVPN client using the previously generated certificates, adds the Azure private DNS resolver IP to `/etc/resolv.conf` to enable name resolution within the private network, and shows the resulting routes. ```bash # Generate the VPN client profile curl -sL -o ~/.certs/vpnconfig.zip $(az network vnet-gateway vpn-client generate \ --ids $(az resource list --resource-type Microsoft.Network/virtualNetworkGateways \ --subscription $ARM_SUBSCRIPTION_ID --query '[0].id' -o tsv) -o tsv) unzip -o -d ~/.certs ~/.certs/vpnconfig.zip if [[ ! -d "/dev/net" ]]; then sudo mkdir /dev/net sudo mknod /dev/net/tun c 10 200 sudo openvpn --mktun --dev tun0 fi sudo touch openvpn.log && sudo chmod 644 openvpn.log sudo openvpn --config ~/.certs/OpenVPN/vpnconfig.ovpn --cert $(ls ~/.certs/*-Cert.pem) --key $(ls ~/.certs/*-Key.pem) --auth-nocache --single-session --dev tun0 & nameserver=$(az resource show --ids $(az resource list --resource-type Microsoft.Network/dnsResolvers/inboundEndpoints --subscription $ARM_SUBSCRIPTION_ID --query '[0].id' -o tsv) --query 'properties.ipConfigurations[0].privateIpAddress' -o tsv) NS_EXISTS=$(cat /etc/resolv.conf | grep "nameserver ${nameserver}") if [[ "${NS_EXISTS}" == "" ]]; then echo "nameserver $nameserver" | cat - /etc/resolv.conf | sudo tee /etc/resolv.conf fi route ``` -------------------------------- ### Generating OpenVPN Certificates - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md This Bash script generates the necessary CA and client certificates for authenticating with the Azure VPN Gateway. It checks for existing certificates, prompts the user for a unique name, installs required tools if missing, and creates the CA and client key/certificate pairs using `ipsec pki` and `openssl`. The generated files are stored in the `~/.certs` directory. ```bash if [ -d ~/.certs ]; then echo "Existing certificate found in ~/.certs" echo "No need to re-generate a new one. To generate a new one, delete the ~/.certs folder and re-run that script." else echo "No existing certificate profiles for openvpn found in ~/.certs" echo "What is your name (unique per devops team - It will generate a certificate for this container and add it to the VPN gateway)?" read name # Install strongswam Open VPN client and tools if [[ "$(echo $(which ipsec))" == "ipsec not found" ]]; then sudo apt-get update sudo apt install -y strongswan strongswan-pki libstrongswan-extra-plugins libtss2-tcti-tabrmd0 net-tools iputils-ping traceroute openvpn network-manager-openvpn fi # Generate the certificate CA mkdir ~/.certs ipsec pki --gen --outform pem > ~/.certs/caKey.pem ipsec pki --self --in ~/.certs/caKey.pem --dn "CN=VPN Rover AZTFMOD Secure Bootstrap CA" --ca --outform pem > ~/.certs/caCert.pem ipsec pki --gen --outform pem > ~/.certs/${name}-Key.pem ipsec pki --pub --in ~/.certs/${name}-Key.pem | ipsec pki --issue --cacert ~/.certs/caCert.pem --cakey ~/.certs/caKey.pem --dn "CN=${name}" --san "${name}" --flag clientAuth --outform pem > ~/.certs/${name}-Cert.pem echo $(openssl x509 -in ~/.certs/caCert.pem -outform der | base64 -w0 ; echo) > ~/.certs/caCert64.pem chmod 740 ~/.certs/* fi ``` -------------------------------- ### Configuring Azure Logic App Module Example - HCL Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/logic_app/105-logic_app_trigger_http_request/README.md This HCL code block provides a complete example configuration for the aztfmod/terraform-azurerm-caf module. It defines necessary global settings, a resource group, the main logic app workflow resource, and a specific HTTP request trigger for the workflow, including the request schema. ```HCL global_settings = { default_region = "region1" regions = { region1 = "australiacentral" } } resource_groups = { rgwflow1 = { name = "exampleRG1" region = "region1" } } logic_app_workflow = { applogic1 = { name = "workflow1" region = "region1" resource_group_key = "rgwflow1" #integration_service_environment_key #logic_app_integration_account_key #workflow_parameters #workflow_schema workflow_version = "1.0.0.0" #parameters } } logic_app_trigger_http_request = { trigger_http_request1 = { name = "webhook" logic_app_key = "applogic1" schema = < terraform apply -var-file terraform destroy -var-file ``` -------------------------------- ### Plan Terraform with Local Var File - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/networking/private_links/endpoints/static_ip/README.md Provides a command to run a Terraform plan operation using a variable file (`configuration.tfvars`) likely located in the current working directory or a relative path. This is a common method for local testing. Requires `terraform` to be installed. ```bash sudo terraform plan -var-file configuration.tfvars ``` -------------------------------- ### Testing Azure VM Module using Rover Tool Plan Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/virtual_machine/210-vm-bastion-winrm/readme.md This snippet shows how to test the same Terraform module configuration using the `rover` tool, typically used in CAF landing zone deployments. It sets the configuration folder, finds parameter files, and executes a `plan` action via `rover`, specifying the landing zone path, parameter files, state file, and deployment level. Dependencies include the `rover` tool, the module code, example configuration, and the CAF landing zone structure. ```bash configuration_folder=/tf/caf/examples/compute/virtual_machine/210-vm-bastion-winrm parameter_files=$(find ${configuration_folder} | grep .tfvars | sed 's/.*/-var-file &/' | xargs) rover -lz /tf/caf/landingzones/caf_example \ ${parameter_files} \ -tfstate 210-vm-bastion-winrm.tfstate\ -level level1 \ -a plan ``` -------------------------------- ### Testing Azure VM Module using Terraform Init and Plan Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/virtual_machine/210-vm-bastion-winrm/readme.md This snippet demonstrates how to test a specific Terraform module configuration using standard Terraform commands. It defines the configuration folder, finds parameter files, initializes Terraform, and generates a plan, specifying the state file and configuration path as variables. Prerequisites include Terraform, the module code, and the example configuration files. ```bash configuration_folder=/tf/caf/examples/compute/virtual_machine/210-vm-bastion-winrm parameter_files=$(find ${configuration_folder} | grep .tfvars | sed 's/.*/-var-file &/' | xargs) cd /tf/caf/landingzones/caf_example terraform init eval terraform plan ${parameter_files} \ -state 210-vm-bastion-winrm.tfstate \ -var var_folder_path="${configuration_folder}" ``` -------------------------------- ### Authenticating Azure with Rover (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/README.md Shows the command to authenticate to your Azure subscription using the `rover` command-line utility, a tool often used with Azure landing zones. It includes both the basic `rover login` command and an option to specify tenant and subscription ID directly. ```bash rover login ### you can alternatively specify the tenant space and subscription ID on command line arguments: rover login --tenant .onmicrosoft.com -s ``` -------------------------------- ### Testing Terraform Module Directly in CAF Landing Zone (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/availability_set/100-simple-availabilityset/readme.md This snippet provides instructions on how to test a specific Terraform module example (Availability Set) by navigating to a CAF landing zone directory, initializing Terraform, and planning the deployment using parameter files found in the module's configuration folder. It demonstrates executing Terraform commands directly within the landing zone context. ```Bash configuration_folder=/tf/caf/examples/compute/availability_set/100-simple-availabilityset parameter_files=$(find ${configuration_folder} | grep .tfvars | sed 's/.*/-var-file &/' | xargs) cd /tf/caf/landingzones/caf_example terraform init eval terraform plan ${parameter_files} \ -var var_folder_path="${configuration_folder}" ``` -------------------------------- ### Configuring Azure CAF Terraform Module (HCL) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/README.md Illustrates how to configure the Azure CAF Terraform module by passing structured input variables in HCL for various resource types like global settings, resource groups, key vaults, compute, and networking. This example shows how to map variables to the module's inputs for a more complete configuration. ```hcl module "caf" { source = "aztfmod/caf/azurerm" version = "5.4.2" global_settings = var.global_settings resource_groups = var.resource_groups keyvaults = var.keyvaults compute = { virtual_machines = var.virtual_machines } networking = { public_ip_addresses = var.public_ip_addresses vnets = var.vnets } } ``` -------------------------------- ### Instantiating Azure CAF Terraform Module (HCL) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/README.md Demonstrates the basic declaration of the Azure CAF Terraform module in HCL, specifying the source and version from the Terraform registry. This snippet shows the minimal required syntax to include the module in a Terraform configuration. ```hcl module "caf" { source = "aztfmod/caf/azurerm" version = "5.4.2" # insert the 7 required variables here } ``` -------------------------------- ### Setting up TF Cloud Environment & Running Rover Plan - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md This Bash script prepares the environment for deploying the Azure bootstrap with private endpoints using `rover` and Terraform Cloud. It performs `terraform login`, logs into Azure CLI using a service principal, exports numerous environment variables for authentication and configuration, including the base64-encoded CA certificate, and triggers a Terraform plan operation via the `rover` command in Terraform Cloud. ```bash # Create a Teams or personnal token (not an organization token as some feature are not supported with that token) terraform login export AZDO_TOKEN=xxxxxx # Generate a Team token, not an organizational token export TFCLOUD_TOKEN=xxxxxx export ARM_SUBSCRIPTION_ID= export ARM_CLIENT_ID=xxxxx export ARM_TENANT_NAME=xxxx.onmicrosoft.com export ARM_TENANT_ID=xxxxx export ARM_CLIENT_SECRET="xxxxxx" az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET -t $ARM_TENANT_ID az account set -s $ARM_SUBSCRIPTION_ID export TF_CLOUD_ORGANIZATION=xxxx export TF_CLOUD_HOSTNAME=app.terraform.io export TF_CLOUD_PROJECT_ID=xxxxx # TF Cloud project (must be created before) export REMOTE_credential_path_json="$(echo ~)/.terraform.d/credentials.tfrc.json" # Make sure you have executed terraform login first export BACKEND_type_hybrid=false export GITOPS_AGENT_POOL_EXECUTION_MODE=remote # This deployment is using hosted TFC agents to bootstrap the environment export TF_VAR_backend_type=remote export TF_CLOUD_WORKSPACE_TF_ENV_bootstrap_root_ca_public_pem=$(cat ~/.certs/caCert64.pem) export TF_CLOUD_WORKSPACE_TF_SEC_ENV_AZDO_TOKEN="$AZDO_TOKEN" export TF_CLOUD_WORKSPACE_TF_SEC_ENV_TFCLOUD_TOKEN="$TFCLOUD_TOKEN" export TF_CLOUD_WORKSPACE_ATTRIBUTES_ASSESSMENTS_ENABLED=true export ROVER_RUNNER=true rover \ -lz /tf/caf/landingzones/caf_solution \ -var-folder /tf/caf/configuration/level0/tfcloud/bootstrap-with-private-endpoints \ -tfstate_subscription_id $ARM_SUBSCRIPTION_ID \ -target_subscription $ARM_SUBSCRIPTION_ID \ -tfstate bootstrap.tfstate \ -env xxx \ -p ${TF_DATA_DIR}/bootstrap.tfstate.tfplan \ -tf_cloud_force_run \ -a plan # once finished execute the apply ``` -------------------------------- ### Listing Docker Containers (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md Lists all currently running Docker containers on the host system. This command is useful for identifying active agent containers by their names or IDs. ```bash sudo docker ps ``` -------------------------------- ### Instantiating Azure Logic App Module - Terraform HCL Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/logic_app/107-logic_app_trigger_custom/README.md This snippet provides a complete configuration example for using the Azure Logic App Terraform module. It defines global settings, a resource group, a logic app workflow, and a custom trigger, showing how to structure the input variables for the module. Requires Terraform with the Azure provider configured. ```HCL global_settings = { default_region = "region1" regions = { region1 = "westus" } } resource_groups = { rgwflow1 = { name = "exampleRG1" region = "region1" } } logic_app_workflow = { applogic1 = { name = "workflow1" region = "region1" resource_group_key = "rgwflow1" #integration_service_environment_key #logic_app_integration_account_key #workflow_parameters #workflow_schema workflow_version = "1.0.0.0" #parameters } } logic_app_trigger_custom = { trigger_custom1 = { name = "webhook" logic_app_key = "applogic1" body = <5.5.0). ```HCL module "caf" { source = "aztfmod/caf/azurerm" version = "~>5.5.0" # Add object as described below } ``` -------------------------------- ### Stopping Systemd Service (Bash) Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/cd-agents/agents-with-private-endpoints/README.tfcloud.md Stops a specific systemd service for a rover agent. This command deactivates the service unit, which typically stops the associated Docker container. ```bash sudo systemctl stop rover-agent-azdo-level0-1.service ``` -------------------------------- ### Instantiating CAF Core Module in HCL Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/azure_virtual_desktop/wvd_resources/README.md This HCL snippet demonstrates how to instantiate the main `aztfmod/caf/azurerm` Terraform module using a `module` block. It requires specifying the source and a specific version. It serves as the entry point for using the module to deploy Azure resources. ```hcl module "caf" { source = "aztfmod/caf/azurerm" version = "5.3.2" # insert the 6 required variables here } ``` -------------------------------- ### Initializing Azure CAF Module in Terraform Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/modules/apim/api_management_user/README.md This Terraform code snippet instantiates the `aztfmod/caf/azurerm` module from the Terraform Registry, pinning it to version `5.1.0`. It serves as a basic example of how to include this specific module in a Terraform configuration file. ```Terraform module "caf" { source = "aztfmod/caf/azurerm" version = "5.1.0" } ``` -------------------------------- ### Testing Terraform Module with `terraform` CLI - Bash Source: https://github.com/aztfmod/terraform-azurerm-caf/blob/main/examples/compute/virtual_machine/100-single-linux-vm/readme.md This script demonstrates how to test a Terraform module configuration by directly executing standard `terraform` commands. It sets the `configuration_folder` variable, finds `.tfvars` files within it, constructs a `-var-file` argument list, changes directory into a test landing zone, initializes Terraform, and then runs a `plan`, `apply`, or `destroy` action using a specific variable file. Requires `terraform` CLI, `find`, `grep`, `sed`, and `xargs`. ```bash configuration_folder=/tf/caf/examples/compute/virtual_machine/100-single-linux-vm parameter_files=$(find ${configuration_folder} | grep .tfvars | sed 's/.*/-var-file &/' | xargs) cd /tf/caf/landingzones/caf_example terraform init terraform [plan | apply | destroy ] \ -var-file ../configuration.tfvars ```