This repository provides an example of deploying an Azure Arc gateway with Terraform!
- Azure Arc gateway deployed with a Terraform module
- "Do not delete" lock on deployed resource
- Clone this repository.
- Copy or rename the
terraform.auto.tfvars.example
file toterraform.auto.tfvars
. - Fill out the Azure Arc gateway name and Azure resource group name for use locally.
- Log in to Azure and run Terraform. The subscription ID can be sourced from the
ARM_SUBSCRIPTION_ID
environment variable.
az login
$env:ARM_SUBSCRIPTION_ID = (az account list | ConvertFrom-Json).id
terraform init
terraform plan
terraform approve
Read the related blog post at https://blog.graa.dev/AzureArc-GatewayTerraform for more information about this scenario.
Use the following outputs when onboarding Azure Connected Machine agents:
terraform output
azure_arc_gateway_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Microsoft.HybridCompute/gateways/arc-gateway"
azure_arc_gateway_url = "gatewayId.gw.arc.azure.com"
The repository structure is as follows.
│ .gitignore
│ LICENSE
│ main.tf
│ provider.tf
│ README.md
│ terraform.auto.tfvars.example
│ variables.tf
│
├───assets
│ portal.png
│
└───modules
└───azure-arc-gateway
main.tf
outputs.tf
README
variables.tf
versions.tf
See the related blog post at https://blog.graa.dev/AzureArc-GatewayTerraform.
Any contributions are welcome and appreciated!