From 232c341d510aab15f9a89036c6794fb6e82ec665 Mon Sep 17 00:00:00 2001 From: Robert Rudduck Date: Mon, 12 Jun 2017 11:29:41 -0500 Subject: [PATCH] Update acceptance tests. Signed-off-by: stack72 --- ...ource_arm_traffic_manager_endpoint_test.go | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/azurerm/resource_arm_traffic_manager_endpoint_test.go b/azurerm/resource_arm_traffic_manager_endpoint_test.go index a4051ec1c035..cb1e82466066 100644 --- a/azurerm/resource_arm_traffic_manager_endpoint_test.go +++ b/azurerm/resource_arm_traffic_manager_endpoint_test.go @@ -175,6 +175,32 @@ func TestAccAzureRMTrafficManagerEndpoint_nestedEndpoints(t *testing.T) { }) } +func TestAccAzureRMTrafficManagerEndpoint_location(t *testing.T) { + ri := acctest.RandInt() + first := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_location, ri, ri, ri, ri) + second := fmt.Sprintf(testAccAzureRMTrafficManagerEndpoint_locationUpdated, ri, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMTrafficManagerEndpointDestroy, + Steps: []resource.TestStep{ + { + Config: first, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.test"), + ), + }, + { + Config: second, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMTrafficManagerEndpointExists("azurerm_traffic_manager_endpoint.test"), + ), + }, + }, + }) +} + func testCheckAzureRMTrafficManagerEndpointExists(name string) resource.TestCheckFunc { return func(s *terraform.State) error { // Ensure we have enough information in state to look up in API @@ -589,3 +615,69 @@ resource "azurerm_traffic_manager_endpoint" "externalChild" { resource_group_name = "${azurerm_resource_group.test.name}" } ` + +var testAccAzureRMTrafficManagerEndpoint_location = ` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "West US" +} + +resource "azurerm_traffic_manager_profile" "test" { + name = "acctesttmpparent%d" + resource_group_name = "${azurerm_resource_group.test.name}" + traffic_routing_method = "Performance" + + dns_config { + relative_name = "acctestparent%d" + ttl = 30 + } + + monitor_config { + protocol = "https" + port = 443 + path = "/" + } +} + +resource "azurerm_traffic_manager_endpoint" "test" { + name = "acctestend-external%d" + type = "externalEndpoints" + target = "terraform.io" + endpoint_location = "${azurerm_resource_group.test.location}" + profile_name = "${azurerm_traffic_manager_profile.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" +} +` + +var testAccAzureRMTrafficManagerEndpoint_locationUpdated = ` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "westus" +} + +resource "azurerm_traffic_manager_profile" "test" { + name = "acctesttmpparent%d" + resource_group_name = "${azurerm_resource_group.test.name}" + traffic_routing_method = "Performance" + + dns_config { + relative_name = "acctestparent%d" + ttl = 30 + } + + monitor_config { + protocol = "https" + port = 443 + path = "/" + } +} + +resource "azurerm_traffic_manager_endpoint" "test" { + name = "acctestend-external%d" + type = "externalEndpoints" + target = "terraform.io" + endpoint_location = "${azurerm_resource_group.test.location}" + profile_name = "${azurerm_traffic_manager_profile.test.name}" + resource_group_name = "${azurerm_resource_group.test.name}" +} +`