Skip to content

Commit 1f403d4

Browse files
authored
Terraform 0.13 upgrade (#56)
* :0.13: * update * update
1 parent 28fc31a commit 1f403d4

File tree

6 files changed

+69
-6
lines changed

6 files changed

+69
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- docker
1414

1515
env:
16-
- TERRAFORM_VERSION=0.12.20 IMAGE_NAME=azure-network-security-group-module
16+
- TERRAFORM_VERSION=0.13.0 IMAGE_NAME=azure-network-security-group-module
1717

1818
jobs:
1919
include:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Pull the base image with given version.
2-
ARG BUILD_TERRAFORM_VERSION="0.12.20"
2+
ARG BUILD_TERRAFORM_VERSION="0.13.0"
33
FROM mcr.microsoft.com/terraform-test:${BUILD_TERRAFORM_VERSION}
44

55
ARG MODULE_NAME="terraform-azurerm-network-security-group"

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ source 'https://rubygems.org/'
22

33
group :test do
44
git 'https://github.com/Azure/terramodtest.git' do
5-
gem 'terramodtest', tag: '0.5.0'
5+
gem 'terramodtest', tag: '0.6.0'
66
end
77
end

README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,59 @@ NOTE: We are working on adding the support for applying a NSG to a network inter
1111

1212
This module includes a a set of pre-defined rules for commonly used protocols (for example HTTP or ActiveDirectory) that can be used directly in their corresponding modules or as independent rules.
1313

14-
## Usage with the generic module
14+
## Usage with the generic module in Terraform 0.13
15+
16+
The following example demonstrate how to use the network-security-group module with a combination of predefined and custom rules.
17+
18+
```hcl
19+
provider "azurerm" {
20+
features {}
21+
}
22+
23+
resource "azurerm_resource_group" "example" {
24+
name = "my-resources"
25+
location = "West Europe"
26+
}
27+
28+
module "network-security-group" {
29+
source = "Azure/network-security-group/azurerm"
30+
resource_group_name = azurerm_resource_group.example.name
31+
location = "EastUS" # Optional; if not provided, will use Resource Group location
32+
security_group_name = "nsg"
33+
source_address_prefix = ["10.0.3.0/24"]
34+
predefined_rules = [
35+
{
36+
name = "SSH"
37+
priority = "500"
38+
},
39+
{
40+
name = "LDAP"
41+
source_port_range = "1024-1026"
42+
}
43+
]
44+
45+
custom_rules = [
46+
{
47+
name = "myhttp"
48+
priority = "200"
49+
direction = "Inbound"
50+
access = "Allow"
51+
protocol = "tcp"
52+
destination_port_range = "8080"
53+
description = "description-myhttp"
54+
}
55+
]
56+
57+
tags = {
58+
environment = "dev"
59+
costcenter = "it"
60+
}
61+
62+
depends_on = [azurerm_resource_group.example]
63+
}
64+
```
65+
66+
## Usage with the generic module in Terraform 0.12
1567

1668
The following example demonstrate how to use the network-security-group module with a combination of predefined and custom rules.
1769

@@ -61,7 +113,7 @@ module "network-security-group" {
61113
}
62114
```
63115

64-
## Usage with the Application Security Group module
116+
## Usage with the Application Security Group module in Terraform 0.12
65117

66118
The following example demonstrate how to use the network-security-group module with a combination of predefined and custom rules with ASG source or destination.
67119

@@ -119,7 +171,7 @@ module "network-security-group" {
119171
}
120172
```
121173

122-
## Usage with the pre-defined module
174+
## Usage with the pre-defined module in Terraform 0.12
123175

124176
The following example demonstrate how to use the pre-defined HTTP module with a custom rule for ssh.
125177

test/fixture/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ module "testPredefinedHTTP" {
1818
source = "../../modules/HTTP/"
1919
resource_group_name = azurerm_resource_group.test.name
2020
security_group_name = "nsg_testPredefinedHTTP"
21+
22+
depends_on = [azurerm_resource_group.test]
2123
}
2224

2325
module "testPredefinedAD" {
2426
source = "../../modules/ActiveDirectory/"
2527
resource_group_name = azurerm_resource_group.test.name
2628
security_group_name = "nsg_testPredefinedAD"
29+
30+
depends_on = [azurerm_resource_group.test]
2731
}
2832

2933
resource "azurerm_application_security_group" "first" {
@@ -52,6 +56,8 @@ module "testPredefinedRuleWithCustom" {
5256
priority = 510
5357
},
5458
]
59+
60+
depends_on = [azurerm_resource_group.test]
5561
}
5662

5763

@@ -84,4 +90,6 @@ module "testCustom" {
8490
destination_application_security_group_ids = [azurerm_application_security_group.second.id]
8591
},
8692
]
93+
94+
depends_on = [azurerm_resource_group.test]
8795
}

variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Network Security Group definition
22
variable "resource_group_name" {
33
description = "Name of the resource group"
4+
type = string
45
}
56

67
variable "security_group_name" {
78
description = "Network security group name"
9+
type = string
810
default = "nsg"
911
}
1012

@@ -17,6 +19,7 @@ variable "tags" {
1719
variable "location" {
1820
description = "Location (Azure Region) for the network security group."
1921
# No default - if it's not specified, use the resource group location (see main.tf)
22+
type = string
2023
default = ""
2124
}
2225

0 commit comments

Comments
 (0)