Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network_profile.*.ip_configuration.*.primary now required for azure_virtual_machine_scale_set #2035

Merged
merged 2 commits into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions azurerm/resource_arm_virtual_machine_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource {

"primary": {
Type: schema.TypeBool,
Optional: true,
Required: true,
manicminer marked this conversation as resolved.
Show resolved Hide resolved
},

"public_ip_address_configuration": {
Expand Down Expand Up @@ -1480,6 +1480,7 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) *
for _, ipConfigConfig := range ipConfigurationConfigs {
ipconfig := ipConfigConfig.(map[string]interface{})
name := ipconfig["name"].(string)
primary := ipconfig["primary"].(bool)
subnetId := ipconfig["subnet_id"].(string)

ipConfiguration := compute.VirtualMachineScaleSetIPConfiguration{
Expand All @@ -1491,6 +1492,8 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) *
},
}

ipConfiguration.Primary = &primary

if v := ipconfig["application_gateway_backend_address_pool_ids"]; v != nil {
pools := v.(*schema.Set).List()
resources := make([]compute.SubResource, 0, len(pools))
Expand Down Expand Up @@ -1527,11 +1530,6 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) *
ipConfiguration.LoadBalancerInboundNatPools = &rulesResources
}

if v := ipconfig["primary"]; v != nil {
primary := v.(bool)
ipConfiguration.Primary = &primary
}

if v := ipconfig["public_ip_address_configuration"]; v != nil {
publicIpConfigs := v.([]interface{})
for _, publicIpConfigConfig := range publicIpConfigs {
Expand Down
29 changes: 29 additions & 0 deletions azurerm/resource_arm_virtual_machine_scale_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -1424,6 +1425,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
accelerated_networking = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -1509,6 +1511,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
ip_forwarding = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -1596,6 +1599,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
}
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -1684,6 +1688,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -1874,6 +1879,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -2070,6 +2076,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
}
Expand Down Expand Up @@ -2183,6 +2190,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
}
Expand Down Expand Up @@ -2301,6 +2309,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
}
Expand Down Expand Up @@ -2368,6 +2377,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -2434,6 +2444,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -2517,6 +2528,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -2582,6 +2594,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -2662,6 +2675,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
application_gateway_backend_address_pool_ids = ["${azurerm_application_gateway.test.backend_address_pool.0.id}"]
}
Expand Down Expand Up @@ -2887,6 +2901,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
load_balancer_inbound_nat_rules_ids = ["${azurerm_lb_nat_pool.test.id}"]
Expand Down Expand Up @@ -2972,6 +2987,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3056,6 +3072,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3151,6 +3168,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3254,6 +3272,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3345,6 +3364,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3456,6 +3476,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3560,6 +3581,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3656,6 +3678,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3742,6 +3765,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
}
Expand Down Expand Up @@ -3837,6 +3861,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -3902,6 +3927,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -4073,6 +4099,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -4149,6 +4176,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = true
ip_configuration {
name = "primary"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand All @@ -4158,6 +4186,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
primary = false
ip_configuration {
name = "secondary"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down
4 changes: 3 additions & 1 deletion website/docs/r/virtual_machine_scale_set.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.bpepool.id}"]
load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_pool.lbnatpool.*.id, count.index)}"]
Expand Down Expand Up @@ -216,6 +217,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = "${azurerm_subnet.test.id}"
}
}
Expand Down Expand Up @@ -374,7 +376,7 @@ output "principal_id" {
* `application_gateway_backend_address_pool_ids` - (Optional) Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of one application gateway. Multiple scale sets cannot use the same application gateway.
* `load_balancer_backend_address_pool_ids` - (Optional) Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer.
* `load_balancer_inbound_nat_rules_ids` - (Optional) Specifies an array of references to inbound NAT rules for load balancers.
* `primary` - (Optional) Specifies if this ip_configuration is the primary one.
* `primary` - (Required) Specifies if this ip_configuration is the primary one.
* `public_ip_address_configuration` - (Optional) describes a virtual machines scale set IP Configuration's
PublicIPAddress configuration. The public_ip_address_configuration is documented below.

Expand Down