Skip to content

Commit

Permalink
feat: support 'source_address_prefixes' rule parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
owlleg6 committed Oct 19, 2023
1 parent 46b9109 commit c7e21fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ No modules.

## Inputs

| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------- | ------- | :------: |
| <a name="input_project"></a> [project](#input\_project) | Project name | `string` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | Environment name | `string` | n/a | yes |
| <a name="input_location"></a> [location](#input\_location) | Specifies the supported Azure location where the resource exists | `string` | n/a | yes |
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | The name of the resource group in which resources is created | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to the resource | `map(string)` | {} | no |
| <a name="input_custom_nsg_name"></a> [custom\_nsg\_name](#input\_custom\_nsg\_name) | Custom network security group name | `string` | null | no |
| <a name="input_security_rules"></a> [security\_rules](#input\_security\_rules) | List of objects representing security rules | <pre>list(object({<br> name = optional(string)<br> description = optional(string)<br> priority = optional(number)<br> direction = optional(string)<br> access = optional(string)<br> protocol = optional(string)<br> source_port_range = optional(string)<br> destination_port_range = optional(string)<br> source_address_prefix = optional(string)<br> destination_address_prefix = optional(string)<br>}))<br></pre> | [] | no |
| Name | Description | Type | Default | Required |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- | :------: |
| <a name="input_project"></a> [project](#input\_project) | Project name | `string` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | Environment name | `string` | n/a | yes |
| <a name="input_location"></a> [location](#input\_location) | Specifies the supported Azure location where the resource exists | `string` | n/a | yes |
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | The name of the resource group in which resources is created | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to the resource | `map(string)` | {} | no |
| <a name="input_custom_nsg_name"></a> [custom\_nsg\_name](#input\_custom\_nsg\_name) | Custom network security group name | `string` | null | no |
| <a name="input_security_rules"></a> [security\_rules](#input\_security\_rules) | List of objects representing security rules | <pre>list(object({<br> name = optional(string)<br> description = optional(string)<br> priority = optional(number)<br> direction = optional(string)<br> access = optional(string)<br> protocol = optional(string)<br> source_port_range = optional(string)<br> destination_port_range = optional(string)<br> source_address_prefix = optional(string)<br> source_address_prefixes = optional(list(string))<br> destination_address_prefix = optional(string)<br>}))<br></pre> | [] | no |


## Outputs
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ resource "azurerm_network_security_group" "this" {
protocol = security_rule.value["protocol"]
source_port_range = security_rule.value["source_port_range"]
destination_port_range = security_rule.value["destination_port_range"]
source_address_prefix = security_rule.value["source_address_prefix"]
source_address_prefix = lookup(security_rule.value, "source_address_prefix", null)
source_address_prefixes = lookup(security_rule.value, "source_address_prefixes", [])
destination_address_prefix = security_rule.value["destination_address_prefix"]
}
}
Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ variable "security_rules" {
source_port_range = optional(string)
destination_port_range = optional(string)
source_address_prefix = optional(string)
source_address_prefixes = optional(list(string))
destination_address_prefix = optional(string)
}))
description = "List of objects representing security rules"
Expand Down

0 comments on commit c7e21fe

Please sign in to comment.