README
¶
tf-azurerm-module_primitive-windows_virtual_machine
Overview
This terraform module creates a Windows virtual machine in Azure.
Usage
See examples/complete for a full working example.
Module Development
Pre-Requisites
The following commands should be available on your system:
asdformisemakepython3(for pre-commit)
Additionally, your git user and email must be configured. Run the make configure command from the root of the repository to ensure that you meet these requirements.
Pre-Commit hooks
The .pre-commit-config.yaml file defines pre-commit hooks for Terraform formatting, validation, documentation generation, and detect-secrets. Hooks are installed when you run make configure. Go linting runs via make lint in local development and CI, not via pre-commit.
Terratest examples
Post-deploy tests in tests/post_deploy_functional/ and tests/post_deploy_functional_readonly/ target examples/complete via an explicit folder constant in each main_test.go. Adding another example (for example examples/minimal) requires a new test entry point or updating that constant; it is not picked up automatically.
Local Validation
You should validate the changes you make to any module locally, prior to pushing your changes in a branch to GitHub.
- Ensure that you have run
make configuresuccessfully. - Ensure you are signed into the appropriate cloud provider (e.g. Azure) for the module under test in your current console session.
- Run the Terraform and Golang linters:
make lint
- Once linters pass, run integration tests (apply, test, destroy):
make test
The pre-commit validations, as well as the make lint and make test targets, are performed in CI. Running them locally before opening a PR helps ensure a smooth review.
Review & Merge Process
Open a Pull Request to the default (main) branch. The PR title must follow Conventional Commits format to merge and to drive semantic versioning.
Ensure CI workflows pass, address review feedback, and obtain approvals required by CODEOWNERS.
Automatic Updates
Shared configuration and workflow files are largely managed through launch-terraform-skeleton. Avoid one-off edits to copied skeleton files in this repository unless necessary (for example .gitignore entries for generated artifacts). Use copier check-update / copier update when refreshing from the skeleton.
Requirements
| Name | Version |
|---|---|
| terraform | >= 1.5.0, < 2.0 |
| azurerm | ~> 3.77 |
Modules
No modules.
Resources
| Name | Type |
|---|---|
| azurerm_windows_virtual_machine.public_vm | resource |
Inputs
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| admin_password | (Required) The password of the local administrator used for the Virtual Machine. Changing this forces a new resource to be created. | string |
n/a | yes |
| admin_username | (Required) The username of the local administrator used for the Virtual Machine. Changing this forces a new resource to be created. | string |
n/a | yes |
| location | (Required) The Azure location where the Windows Virtual Machine should exist. Changing this forces a new resource to be created. | string |
n/a | yes |
| name | (Required) The name of the Windows Virtual Machine. Changing this forces a new resource to be created. | string |
n/a | yes |
| network_interface_ids | (Required). A list of Network Interface IDs which should be attached to this Virtual Machine. The first Network Interface ID in this list will be the Primary Network Interface on the Virtual Machine. | list(string) |
n/a | yes |
| os_disk | An os_disk block. | object({ |
n/a | yes |
| resource_group_name | (Required) The name of the Resource Group in which the Windows Virtual Machine should be exist. Changing this forces a new resource to be created. | string |
n/a | yes |
| size | (Required) The SKU which should be used for this Virtual Machine, such as Standard_F2. | string |
n/a | yes |
| source_image_reference | A source_image_reference block. | object({ |
n/a | yes |
Outputs
| Name | Description |
|---|---|
| id | The ID of the Windows Virtual Machine. |
| private_ip_address | The Primary Private IP Address assigned to this Virtual Machine |
| private_ip_addresses | A list of Private IP Addresses assigned to this Virtual Machine. |
| public_ip_address | The Primary Public IP Address assigned to this Virtual Machine. |
| public_ip_addresses | A list of Public IP Addresses assigned to this Virtual Machine. |
| virtual_machine_id | The ID of the Virtual Machine. |