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

azurerm_traffic_manager_endpoint - supports for min_child_endpoints_ipv4 and min_child_endpoints_ipv6 #12400

Merged
merged 6 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion azurerm/internal/services/trafficmanager/client/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
Expand Down Expand Up @@ -116,6 +116,16 @@ func resourceArmTrafficManagerEndpoint() *pluginsdk.Resource {
Optional: true,
},

"min_child_endpoints_ipv4": {
Type: pluginsdk.TypeInt,
Optional: true,
},

"min_child_endpoints_ipv6": {
magodo marked this conversation as resolved.
Show resolved Hide resolved
Type: pluginsdk.TypeInt,
Optional: true,
},

"geo_mappings": {
Type: pluginsdk.TypeList,
Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString},
Expand Down Expand Up @@ -253,7 +263,10 @@ func resourceArmTrafficManagerEndpointRead(d *pluginsdk.ResourceData, meta inter
d.Set("priority", props.Priority)
d.Set("endpoint_location", props.EndpointLocation)
d.Set("endpoint_monitor_status", props.EndpointMonitorStatus)

d.Set("min_child_endpoints", props.MinChildEndpoints)
d.Set("min_child_endpoints_ipv4", props.MinChildEndpointsIPv4)
d.Set("min_child_endpoints_ipv6", props.MinChildEndpointsIPv6)
d.Set("geo_mappings", props.GeoMapping)
if err := d.Set("subnet", flattenAzureRMTrafficManagerEndpointSubnetConfig(props.Subnets)); err != nil {
return fmt.Errorf("setting `subnet`: %s", err)
Expand Down Expand Up @@ -324,8 +337,15 @@ func getArmTrafficManagerEndpointProperties(d *pluginsdk.ResourceData) *trafficm
}

if minChildEndpoints := d.Get("min_child_endpoints").(int); minChildEndpoints != 0 {
mci64 := int64(minChildEndpoints)
endpointProps.MinChildEndpoints = &mci64
endpointProps.MinChildEndpoints = utils.Int64(int64(minChildEndpoints))
}

if minChildEndpoints := d.Get("min_child_endpoints_ipv4").(int); minChildEndpoints != 0 {
endpointProps.MinChildEndpointsIPv4 = utils.Int64(int64(minChildEndpoints))
}

if minChildEndpoints := d.Get("min_child_endpoints_ipv6").(int); minChildEndpoints != 0 {
endpointProps.MinChildEndpointsIPv6 = utils.Int64(int64(minChildEndpoints))
}

subnetSlice := make([]trafficmanager.EndpointPropertiesSubnetsItem, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,15 @@ resource "azurerm_traffic_manager_profile" "child" {
}

resource "azurerm_traffic_manager_endpoint" "nested" {
name = "acctestend-parent%d"
type = "nestedEndpoints"
target_resource_id = azurerm_traffic_manager_profile.child.id
priority = 1
profile_name = azurerm_traffic_manager_profile.parent.name
resource_group_name = azurerm_resource_group.test.name
min_child_endpoints = 1
name = "acctestend-parent%d"
type = "nestedEndpoints"
target_resource_id = azurerm_traffic_manager_profile.child.id
priority = 1
profile_name = azurerm_traffic_manager_profile.parent.name
resource_group_name = azurerm_resource_group.test.name
min_child_endpoints = 5
min_child_endpoints_ipv4 = 2
min_child_endpoints_ipv6 = 2
}

resource "azurerm_traffic_manager_endpoint" "externalChild" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/pluginsdk"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/validation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/trafficmanager/parse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
Expand Down Expand Up @@ -62,12 +62,12 @@ func resourceArmTrafficManagerProfile() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(trafficmanager.Geographic),
string(trafficmanager.Weighted),
string(trafficmanager.Performance),
string(trafficmanager.Priority),
string(trafficmanager.Subnet),
string(trafficmanager.MultiValue),
string(trafficmanager.TrafficRoutingMethodGeographic),
string(trafficmanager.TrafficRoutingMethodWeighted),
string(trafficmanager.TrafficRoutingMethodPerformance),
string(trafficmanager.TrafficRoutingMethodPriority),
string(trafficmanager.TrafficRoutingMethodSubnet),
string(trafficmanager.TrafficRoutingMethodMultiValue),
}, false),
},

Expand Down Expand Up @@ -128,9 +128,9 @@ func resourceArmTrafficManagerProfile() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(trafficmanager.HTTP),
string(trafficmanager.HTTPS),
string(trafficmanager.TCP),
string(trafficmanager.MonitorProtocolHTTP),
string(trafficmanager.MonitorProtocolHTTPS),
string(trafficmanager.MonitorProtocolTCP),
}, true),
DiffSuppressFunc: suppress.CaseDifference,
},
Expand Down Expand Up @@ -235,7 +235,7 @@ func resourceArmTrafficManagerProfileCreate(d *pluginsdk.ResourceData, meta inte
profile.TrafficViewEnrollmentStatus = expandArmTrafficManagerTrafficView(trafficViewStatus.(bool))
}

if profile.ProfileProperties.TrafficRoutingMethod == trafficmanager.MultiValue &&
if profile.ProfileProperties.TrafficRoutingMethod == trafficmanager.TrafficRoutingMethodMultiValue &&
profile.ProfileProperties.MaxReturn == nil {
return fmt.Errorf("`max_return` must be specified when `traffic_routing_method` is set to `MultiValue`")
}
Expand Down

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading