-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.yaml
157 lines (147 loc) · 5.78 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AZURE NETWORK SECURITY GROUP
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-azure-network-security-group
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-azure-network-security-group.svg"
url: "https://github.com/clouddrove/terraform-azure-network-security-group/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-azure-network-security-group/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-azure-network-security-group/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
# description of this project
description: |-
Terraform module to create NETWORK SECURITY GROUP resource on AZURE.
# extra content
include:
- "terraform.md"
# How to use this project
# yamllint disable rule:line-length
usage: |-
### Basic Example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "network_security_group" {
source = "clouddrove/network-security-group/azure"
name = local.name
environment = local.environment
resource_group_name = "app-storage-test-resource-group"
resource_group_location = "North Europe"
subnet_ids = ["/subscriptions/068245d4-3c94-42fe-9c4d-9e5e1cabc60c/resourceGroups/"]
inbound_rules = [
{
name = "ssh"
priority = 101
access = "Allow"
protocol = "Tcp"
source_address_prefix = "10.20.0.0/32"
source_port_range = "*"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
},
{
name = "https"
priority = 102
access = "Allow"
protocol = "*"
source_address_prefix = "VirtualNetwork"
source_port_range = "80,443"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
}
]
enable_diagnostic = false
}
```
### complete Example
```hcl
module "network_security_group" {
depends_on = [module.subnet]
source = "clouddrove/network-security-group/azure"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
inbound_rules = [
{
name = "ssh"
priority = 101
access = "Allow"
protocol = "Tcp"
source_address_prefix = "10.20.0.0/32"
source_port_range = "*"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
},
{
name = "https"
priority = 102
access = "Allow"
protocol = "*"
source_address_prefix = "VirtualNetwork"
source_port_range = "80,443"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
}
]
enable_diagnostic = true
log_analytics_workspace_id = module.log-analytics.workspace_id
}
```
### nsg-with-flow-logs Example
```hcl
module "network_security_group" {
depends_on = [module.subnet]
source = "clouddrove/network-security-group/azure"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
enable_flow_logs = true
network_watcher_name = module.vnet.network_watcher_name
flow_log_storage_account_id = module.storage.default_storage_account_id
enable_traffic_analytics = false
flow_log_retention_policy_enabled = true
inbound_rules = [
{
name = "ssh"
priority = 101
access = "Allow"
protocol = "Tcp"
source_address_prefix = "10.20.0.0/32"
source_port_range = "*"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
},
{
name = "https"
priority = 102
access = "Allow"
protocol = "*"
source_address_prefix = "VirtualNetwork"
source_port_range = "80,443"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
}
]
}
```