mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-07 22:53:08 -06:00
cc18e4d7ca
* provider/azurerm: vendor arm/trafficmanager package * provider/azurerm: add azurerm_traffic_manager_profile resource * provider/azurerm: add azurerm_traffic_manager_endpoint resource * provider/azurerm: document traffic manager resources * provider/azurerm: use short type argument for traffic manager endpoint The resource now takes the short type for example azureEndpoints instead of the long form Microsoft.Network/TrafficManagerProfiles/azureEndpoints. ``` TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMTrafficManagerEndpoint -timeout 120m === RUN TestAccAzureRMTrafficManagerEndpoint_basic --- PASS: TestAccAzureRMTrafficManagerEndpoint_basic (179.72s) === RUN TestAccAzureRMTrafficManagerEndpoint_basicDisableExternal --- PASS: TestAccAzureRMTrafficManagerEndpoint_basicDisableExternal (171.36s) === RUN TestAccAzureRMTrafficManagerEndpoint_updateWeight --- PASS: TestAccAzureRMTrafficManagerEndpoint_updateWeight (167.24s) === RUN TestAccAzureRMTrafficManagerEndpoint_updatePriority --- PASS: TestAccAzureRMTrafficManagerEndpoint_updatePriority (192.91s) === RUN TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints --- PASS: TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints (111.18s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 822.534s ``` * provider/azurerm: remove unnecesary dereferences in traffic manager resources ``` TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMTrafficManager -timeout 120m === RUN TestAccAzureRMTrafficManagerEndpoint_basic --- PASS: TestAccAzureRMTrafficManagerEndpoint_basic (176.08s) === RUN TestAccAzureRMTrafficManagerEndpoint_basicDisableExternal --- PASS: TestAccAzureRMTrafficManagerEndpoint_basicDisableExternal (172.28s) === RUN TestAccAzureRMTrafficManagerEndpoint_updateWeight --- PASS: TestAccAzureRMTrafficManagerEndpoint_updateWeight (148.97s) === RUN TestAccAzureRMTrafficManagerEndpoint_updatePriority --- PASS: TestAccAzureRMTrafficManagerEndpoint_updatePriority (101.18s) === RUN TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints --- PASS: TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints (88.33s) === RUN TestAccAzureRMTrafficManagerProfile_weighted --- PASS: TestAccAzureRMTrafficManagerProfile_weighted (80.92s) === RUN TestAccAzureRMTrafficManagerProfile_performance --- PASS: TestAccAzureRMTrafficManagerProfile_performance (82.98s) === RUN TestAccAzureRMTrafficManagerProfile_priority --- PASS: TestAccAzureRMTrafficManagerProfile_priority (81.07s) === RUN TestAccAzureRMTrafficManagerProfile_withTags --- PASS: TestAccAzureRMTrafficManagerProfile_withTags (102.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 1034.458s ```
540 lines
17 KiB
Go
540 lines
17 KiB
Go
package azurerm
|
|
|
|
import (
|
|
"fmt"
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/Azure/azure-sdk-for-go/core/http"
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
func TestAccAzureRMTrafficManagerEndpoint_basic(t *testing.T) {
|
|
ri := acctest.RandInt()
|
|
config := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_basic, ri, ri, ri, ri, ri, ri, ri)
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
|
|
Steps: []resource.TestStep{
|
|
resource.TestStep{
|
|
Config: config,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testAzure"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testAzure", "endpoint_status", "Enabled"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "endpoint_status", "Enabled"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func TestAccAzureRMTrafficManagerEndpoint_basicDisableExternal(t *testing.T) {
|
|
ri := acctest.RandInt()
|
|
preConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_basic, ri, ri, ri, ri, ri, ri, ri)
|
|
postConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_basicDisableExternal, ri, ri, ri, ri, ri, ri, ri)
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: preConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testAzure"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testAzure", "endpoint_status", "Enabled"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "endpoint_status", "Enabled"),
|
|
),
|
|
},
|
|
{
|
|
Config: postConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testAzure"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testAzure", "endpoint_status", "Enabled"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "endpoint_status", "Disabled"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
// Altering weight might be used to ramp up migration traffic
|
|
func TestAccAzureRMTrafficManagerEndpoint_updateWeight(t *testing.T) {
|
|
ri := acctest.RandInt()
|
|
preConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_weight, ri, ri, ri, ri, ri)
|
|
postConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_updateWeight, ri, ri, ri, ri, ri)
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: preConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternalNew"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "weight", "50"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternalNew", "weight", "50"),
|
|
),
|
|
},
|
|
{
|
|
Config: postConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternalNew"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "weight", "25"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternalNew", "weight", "75"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
// Altering priority might be used to switch failover/active roles
|
|
func TestAccAzureRMTrafficManagerEndpoint_updatePriority(t *testing.T) {
|
|
ri := acctest.RandInt()
|
|
preConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_priority, ri, ri, ri, ri, ri)
|
|
postConfig := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_updatePriority, ri, ri, ri, ri, ri)
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: preConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternalNew"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "priority", "1"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternalNew", "priority", "2"),
|
|
),
|
|
},
|
|
{
|
|
Config: postConfig,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternal"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.testExternalNew"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternal", "priority", "3"),
|
|
resource.TestCheckResourceAttr("azurerm_traffic_manager_endpoint.testExternalNew", "priority", "2"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints(t *testing.T) {
|
|
ri := acctest.RandInt()
|
|
config := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_nestedEndpoints, ri, ri, ri, ri, ri, ri, ri)
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: config,
|
|
Check: resource.ComposeTestCheckFunc(
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.nested"),
|
|
testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.externalChild"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func testCheckAzureRMTrafficManagerEndpointExists(name string) resource.TestCheckFunc {
|
|
return func(s *terraform.State) error {
|
|
// Ensure we have enough information in state to look up in API
|
|
rs, ok := s.RootModule().Resources[name]
|
|
if !ok {
|
|
return fmt.Errorf("Not found: %s", name)
|
|
}
|
|
|
|
name := rs.Primary.Attributes["name"]
|
|
endpointType := rs.Primary.Attributes["type"]
|
|
profileName := rs.Primary.Attributes["profile_name"]
|
|
resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
|
|
if !hasResourceGroup {
|
|
return fmt.Errorf("Bad: no resource group found in state for Traffic Manager Profile: %s", name)
|
|
}
|
|
|
|
// Ensure resource group/virtual network combination exists in API
|
|
conn := testAccProvider.Meta().(*ArmClient).trafficManagerEndpointsClient
|
|
|
|
resp, err := conn.Get(resourceGroup, profileName, path.Base(endpointType), name)
|
|
if err != nil {
|
|
return fmt.Errorf("Bad: Get on trafficManagerEndpointsClient: %s", err)
|
|
}
|
|
|
|
if resp.StatusCode == http.StatusNotFound {
|
|
return fmt.Errorf("Bad: Traffic Manager Endpoint %q (resource group: %q) does not exist", name, resourceGroup)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func testCheckAzureRMTrafficManagerEndpointDestroy(s *terraform.State) error {
|
|
conn := testAccProvider.Meta().(*ArmClient).trafficManagerEndpointsClient
|
|
|
|
for _, rs := range s.RootModule().Resources {
|
|
if rs.Type != "azurerm_traffic_manager_endpoint" {
|
|
continue
|
|
}
|
|
|
|
name := rs.Primary.Attributes["name"]
|
|
endpointType := rs.Primary.Attributes["type"]
|
|
profileName := rs.Primary.Attributes["profile_name"]
|
|
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
|
|
|
resp, err := conn.Get(resourceGroup, profileName, path.Base(endpointType), name)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
if resp.StatusCode != http.StatusNotFound {
|
|
return fmt.Errorf("Traffic Manager Endpoint sitll exists:\n%#v", resp.Properties)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_basic = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Weighted"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_public_ip" "test" {
|
|
name = "acctestpublicip-%d"
|
|
location = "West US"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
public_ip_address_allocation = "static"
|
|
domain_name_label = "acctestpublicip-%d"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testAzure" {
|
|
name = "acctestend-azure%d"
|
|
type = "azureEndpoints"
|
|
target_resource_id = "${azurerm_public_ip.test.id}"
|
|
weight = 3
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
weight = 3
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_basicDisableExternal = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Weighted"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_public_ip" "test" {
|
|
name = "acctestpublicip-%d"
|
|
location = "West US"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
public_ip_address_allocation = "static"
|
|
domain_name_label = "acctestpublicip-%d"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testAzure" {
|
|
name = "acctestend-azure%d"
|
|
type = "azureEndpoints"
|
|
target_resource_id = "${azurerm_public_ip.test.id}"
|
|
weight = 3
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
endpoint_status = "Disabled"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
weight = 3
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_weight = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Weighted"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
weight = 50
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
|
|
name = "acctestend-external%d-2"
|
|
type = "externalEndpoints"
|
|
target = "www.terraform.io"
|
|
weight = 50
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_updateWeight = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Weighted"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
weight = 25
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
|
|
name = "acctestend-external%d-2"
|
|
type = "externalEndpoints"
|
|
target = "www.terraform.io"
|
|
weight = 75
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_priority = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Priority"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
priority = 1
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
|
|
name = "acctestend-external%d-2"
|
|
type = "externalEndpoints"
|
|
target = "www.terraform.io"
|
|
priority = 2
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_updatePriority = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "test" {
|
|
name = "acctesttmp%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Priority"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmp%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternal" {
|
|
name = "acctestend-external%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
priority = 3
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
|
|
name = "acctestend-external%d-2"
|
|
type = "externalEndpoints"
|
|
target = "www.terraform.io"
|
|
priority = 2
|
|
profile_name = "${azurerm_traffic_manager_profile.test.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|
|
|
|
var testAccAzureRMTrafficManagerEndpoint_nestedEndpoints = `
|
|
resource "azurerm_resource_group" "test" {
|
|
name = "acctestrg-%d"
|
|
location = "West US"
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "parent" {
|
|
name = "acctesttmpparent%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Priority"
|
|
|
|
dns_config {
|
|
relative_name = "acctestparent%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_profile" "child" {
|
|
name = "acctesttmpchild%d"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
traffic_routing_method = "Priority"
|
|
|
|
dns_config {
|
|
relative_name = "acctesttmpchild%d"
|
|
ttl = 30
|
|
}
|
|
|
|
monitor_config {
|
|
protocol = "https"
|
|
port = 443
|
|
path = "/"
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
resource "azurerm_traffic_manager_endpoint" "externalChild" {
|
|
name = "acctestend-child%d"
|
|
type = "externalEndpoints"
|
|
target = "terraform.io"
|
|
priority = 1
|
|
profile_name = "${azurerm_traffic_manager_profile.child.name}"
|
|
resource_group_name = "${azurerm_resource_group.test.name}"
|
|
}
|
|
`
|