README
¶
tf-azurerm-module_primitive-network_security_group
Overview
This module deploys a network security group.
Usage
See examples/nsg 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/nsg via an explicit folder constant in each main_test.go. Adding another example 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.3 |
| azurerm | ~> 3.77 |
Modules
No modules.
Resources
| Name | Type |
|---|---|
| azurerm_network_security_group.network_security_group | resource |
Inputs
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| location | (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. | string |
n/a | yes |
| name | (Required) Specifies the name of the network security group. Changing this forces a new resource to be created. | string |
n/a | yes |
| resource_group_name | (Required) The name of the resource group in which to create the network security group. Changing this forces a new resource to be created. | string |
n/a | yes |
| security_rules | (Optional) A list of security rules associated with the network security group. | list(object({ |
null |
no |
| tags | (Optional) A mapping of tags to assign to the resource. | map(string) |
{} |
no |
Outputs
| Name | Description |
|---|---|
| network_security_group_id | value of the network security group id. |