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 all commits
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
31 changes: 31 additions & 0 deletions azurerm/resource_arm_virtual_machine_scale_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,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 @@ -1249,6 +1250,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 +1426,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 +1512,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 +1600,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 +1689,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 +1880,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 @@ -1959,6 +1966,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 +2078,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 +2192,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 +2311,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 +2379,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 +2446,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 +2530,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 +2596,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 +2677,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 +2903,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 +2989,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 +3074,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 +3170,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 +3274,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 +3366,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 +3478,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 +3583,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 +3680,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 +3767,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 +3863,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 +3929,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 +4101,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 +4178,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 +4188,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