Skip to content

Commit

Permalink
azurerm_route_table - add disable_bg_route_propagation property
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Jun 24, 2018
2 parents 3d5432d + 388b149 commit 9e30f85
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

IMPROVEMENTS:

* dependencies: upgrading to v10.11.4 of `Azure/go-autorest` [GH-1418]
* dependencies: upgrading to v17.4.0 of `Azure/azure-sdk-for-go` [GH-1418]
* `azurerm_log_analytics_solution` - support for Sovereign Clouds [GH-1410]
* `azurerm_log_analytics_workspace` - support for Sovereign Clouds [GH-1410]
* `azurerm_log_analytics_workspace` - support for the `PerGB2018` SKU [GH-1079]
* `azurerm_sql_database` - support for importing from a bacpac backup [GH-972]
* `azurerm_network_interface` - addtional validation on properties [GH-1403]
* `azurerm_arm_loadbalancer` - addtional validation on properties [GH-1403]

BUG FIXES:

* validation: ensuring IPv4/MAC addresses are detected correctly [GH-1431]

## 1.7.0 (June 16, 2018)

Expand Down
10 changes: 6 additions & 4 deletions azurerm/helpers/validate/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package validate

import (
"fmt"
"net"
"regexp"
)

Expand All @@ -12,8 +13,9 @@ func Ip4Address(i interface{}, k string) (_ []string, errors []error) {
return
}

if matched := regexp.MustCompile(`((^[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`).Match([]byte(v)); !matched {
errors = append(errors, fmt.Errorf("%q is not a valid IP4 address: '%q`", k, i))
ip := net.ParseIP(v)
if four := ip.To4(); four == nil {
errors = append(errors, fmt.Errorf("%q is not a valid IP4 address: %q", k, v))
}

return
Expand All @@ -26,8 +28,8 @@ func MacAddress(i interface{}, k string) (_ []string, errors []error) {
return
}

if matched := regexp.MustCompile(`((^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`).Match([]byte(v)); !matched {
errors = append(errors, fmt.Errorf("%q is not a valid MAC address: '%q`", k, i))
if matched := regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`).Match([]byte(v)); !matched {
errors = append(errors, fmt.Errorf("%q is not a valid MAC address: %q", k, i))
}

return
Expand Down
10 changes: 5 additions & 5 deletions azurerm/helpers/validate/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ func TestHelper_Validate_Ip4Address(t *testing.T) {
Errors: 1,
},
{
Ip: "000.000.000.000",
Errors: 1,
Ip: "0.0.0.0",
Errors: 0,
},
{
Ip: "1.2.3.no",
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestHelper_Validate_Ip4Address(t *testing.T) {
_, errors := Ip4Address(tc.Ip, "test")

if len(errors) < tc.Errors {
t.Fatalf("Expected AzureResourceId to have an error for %q", tc.Ip)
t.Fatalf("Expected Ip4Address to have an error for %q", tc.Ip)
}
}
}
Expand Down Expand Up @@ -86,10 +86,10 @@ func TestHelper_Validate_MacAddress(t *testing.T) {
}

for _, tc := range cases {
_, errors := Ip4Address(tc.Ip, "test")
_, errors := MacAddress(tc.Ip, "test")

if len(errors) < tc.Errors {
t.Fatalf("Expected AzureResourceId to have an error for %q", tc.Ip)
t.Fatalf("Expected MacAddress to have an error for %q", tc.Ip)
}
}
}
2 changes: 1 addition & 1 deletion azurerm/resource_arm_route_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ resource "azurerm_subnet" "subnet1" {
route_table_id = "${azurerm_route_table.test.id}"
}
resource "azurerm_route_table" "test" {
resource "azurerm_route_table" "subnet1" {
name = "acctestrt%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
Expand Down
109 changes: 109 additions & 0 deletions azurerm/resource_arm_virtual_network_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,69 @@ func TestAccAzureRMVirtualNetworkGateway_activeActive(t *testing.T) {
})
}

func TestAccAzureRMVirtualNetworkGateway_standard(t *testing.T) {
resourceName := "azurerm_virtual_network_gateway.test"
ri := acctest.RandInt()
config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "Standard")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualNetworkGatewayExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "sku", "Standard"),
),
},
},
})
}

func TestAccAzureRMVirtualNetworkGateway_vpnGw2(t *testing.T) {
resourceName := "azurerm_virtual_network_gateway.test"
ri := acctest.RandInt()
config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "VpnGw2")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualNetworkGatewayExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "sku", "VpnGw2"),
),
},
},
})
}

func TestAccAzureRMVirtualNetworkGateway_vpnGw3(t *testing.T) {
resourceName := "azurerm_virtual_network_gateway.test"
ri := acctest.RandInt()
config := testAccAzureRMVirtualNetworkGateway_sku(ri, testLocation(), "VpnGw3")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualNetworkGatewayExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "sku", "VpnGw3"),
),
},
},
})
}

func TestAccAzureRMVirtualNetworkGateway_vpnClientConfig(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_virtual_network_gateway.test"
Expand Down Expand Up @@ -428,3 +491,49 @@ resource "azurerm_virtual_network_gateway" "test" {
}
`, rInt, location, rInt, rInt, rInt)
}

func testAccAzureRMVirtualNetworkGateway_sku(rInt int, location string, sku string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_virtual_network" "test" {
name = "acctestvn-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
address_space = ["10.0.0.0/16"]
}
resource "azurerm_subnet" "test" {
name = "GatewaySubnet"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_network_name = "${azurerm_virtual_network.test.name}"
address_prefix = "10.0.1.0/24"
}
resource "azurerm_public_ip" "test" {
name = "acctestpip-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
public_ip_address_allocation = "Dynamic"
}
resource "azurerm_virtual_network_gateway" "test" {
name = "acctestvng-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
type = "Vpn"
vpn_type = "RouteBased"
sku = "%s"
ip_configuration {
public_ip_address_id = "${azurerm_public_ip.test.id}"
private_ip_address_allocation = "Dynamic"
subnet_id = "${azurerm_subnet.test.id}"
}
}
`, rInt, location, rInt, rInt, rInt, sku)
}
2 changes: 1 addition & 1 deletion website/docs/d/storage_account_sas.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ output "sas_url_query_string" {

* `connection_string` - (Required) The connection string for the storage account to which this SAS applies. Typically directly from the `primary_connection_string` attribute of a terraform created `azurerm_storage_account` resource.
* `https_only` - (Optional) Only permit `https` access. If `false`, both `http` and `https` are permitted. Defaults to `true`.
* `resouce_types` - (Required) A `resource_types` block as defined below.
* `resource_types` - (Required) A `resource_types` block as defined below.
* `services` - (Required) A `services` block as defined below.
* `start` - (Required) The starting time and date of validity of this SAS. Must be a valid ISO-8601 format time/date string.
* `expiry` - (Required) The expiration time and date of this SAS. Must be a valid ISO-8601 format time/date string.
Expand Down

0 comments on commit 9e30f85

Please sign in to comment.