diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index c5f7e3eae7c..dbc501e50b3 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -189,7 +189,8 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // TODO Reinstate AppMesh tagging support. + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -236,15 +237,16 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // TODO Reinstate AppMesh tagging support. + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -268,15 +270,16 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // TODO Reinstate AppMesh tagging support. + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshRouteRead(d, meta) } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index d0019d29f6c..e6eb576b956 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -216,61 +216,62 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { }) } -func testAccAwsAppmeshRoute_tags(t *testing.T) { - var r appmesh.RouteData - resourceName := "aws_appmesh_route.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// TODO Reinstate AppMesh tagging support. +// func testAccAwsAppmeshRoute_tags(t *testing.T) { +// var r appmesh.RouteData +// resourceName := "aws_appmesh_route.foo" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) +// vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshRouteDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshconn @@ -466,33 +467,34 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -resource "aws_appmesh_route" "foo" { - name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" - - spec { - http_route { - match { - prefix = "/" - } - - action { - weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" - weight = 100 - } - } - } - } - - tags = { - %[2]s = %[3]q - %[4]s = %[5]q - } -} -`, rName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// TODO Reinstate AppMesh tagging support. +// func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` + +// resource "aws_appmesh_route" "foo" { +// name = %[1]q +// mesh_name = "${aws_appmesh_mesh.foo.id}" +// virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + +// spec { +// http_route { +// match { +// prefix = "/" +// } + +// action { +// weighted_target { +// virtual_node = "${aws_appmesh_virtual_node.foo.name}" +// weight = 100 +// } +// } +// } +// } + +// tags = { +// %[2]s = %[3]q +// %[4]s = %[5]q +// } +// } +// `, rName, tagKey1, tagValue1, tagKey2, tagValue2) +// } diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index bc26eadbc17..fd305636253 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -14,7 +14,8 @@ func TestAccAWSAppmesh(t *testing.T) { "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - "tags": testAccAwsAppmeshRoute_tags, + // TODO Reinstate AppMesh tagging support. + // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic,