README
¶
tf-azurerm-module_primitive-virtual_network
Overview
This terraform module creates a Azure Virtual Network with subnets.
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, < 5.0 |
Modules
No modules.
Resources
| Name | Type |
|---|---|
| azurerm_subnet.subnet | resource |
| azurerm_subnet_network_security_group_association.subnet_nsg_association | resource |
| azurerm_subnet_route_table_association.subnet_rt_association | resource |
| azurerm_virtual_network.vnet | resource |
| azurerm_route_table.existing_table | data source |
Inputs
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| address_space | The address space that is used by the virtual network. | list(string) |
n/a | yes |
| bgp_community | (Optional) The BGP community attribute in format <as-number>:<community-value>. |
string |
null |
no |
| ddos_protection_plan | The set of DDoS protection plan configuration | object({ |
null |
no |
| dns_servers | The DNS servers to be used with vNet. | list(string) |
[] |
no |
| resource_group_name | Name of the resource group to be imported. | string |
n/a | yes |
| subnets | A mapping of subnet names to their configurations. | map(object({ |
{} |
no |
| tags | The tags to associate with resources provisioned by this module. | map(string) |
{} |
no |
| vnet_location | The location of the vnet to create. | string |
n/a | yes |
| vnet_name | Name of the vnet to create | string |
n/a | yes |
Outputs
| Name | Description |
|---|---|
| subnet_map | Maps the name of the subnets to their full outputs. |
| subnet_name_id_map | Maps the names of the subnets to the ID created. |
| subnet_route_associations | n/a |
| vnet_address_space | The address space of the newly created vNet |
| vnet_guid | The GUID of the newly created vNet |
| vnet_id | The id of the newly created vNet |
| vnet_location | The location of the newly created vNet |
| vnet_name | The Name of the newly created vNet |