From aae5986b918cebf5b7f78fd5c28769a75e09191c Mon Sep 17 00:00:00 2001 From: Bhavesh Shrivastav <91112322+BShrivastav@users.noreply.github.com> Date: Sat, 15 Apr 2023 16:01:20 +0530 Subject: [PATCH] Remove deprecated resource - is_vpc_route (#4496) * removed complete support for the VPC route. * Update resource_ibm_is_vpc_address_prefix.go * Delete is_vpc_route.html.markdown * removing unused variable and the validation for the same. * Update resource_ibm_is_vpn_gateway.go --- examples/ibm-is-ng/main.tf | 9 - ibm/acctest/acctest.go | 8 +- ibm/provider/provider.go | 2 - .../vpc/resource_ibm_is_vpc_address_prefix.go | 7 - ibm/service/vpc/resource_ibm_is_vpc_route.go | 411 ------------------ .../vpc/resource_ibm_is_vpc_route_test.go | 134 ------ .../vpc/resource_ibm_is_vpn_gateway.go | 2 +- website/docs/r/is_vpc_route.html.markdown | 74 ---- 8 files changed, 2 insertions(+), 645 deletions(-) delete mode 100644 ibm/service/vpc/resource_ibm_is_vpc_route.go delete mode 100644 ibm/service/vpc/resource_ibm_is_vpc_route_test.go delete mode 100644 website/docs/r/is_vpc_route.html.markdown diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 174222bcd1..cc41500ab0 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -10,15 +10,6 @@ resource "ibm_is_vpc_address_prefix" "testacc_vpc_address_prefix" { is_default = true } -resource "ibm_is_vpc_route" "route1" { - name = "route1" - vpc = ibm_is_vpc.vpc1.id - zone = var.zone1 - destination = "192.168.4.0/24" - next_hop = "10.240.0.4" - depends_on = [ibm_is_subnet.subnet1] -} - resource "ibm_is_subnet" "subnet1" { name = "subnet1" vpc = ibm_is_vpc.vpc1.id diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 02f3711dfc..a840264e76 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -698,16 +698,10 @@ func init() { fmt.Println("[INFO] Set the environment variable IS_VOLUME_PROFILE for testing ibm_is_volume_profile else it is set to default value 'general-purpose'") } - ISRouteDestination = os.Getenv("SL_ROUTE_DESTINATION") - if ISRouteDestination == "" { - ISRouteDestination = "192.168.4.0/24" - fmt.Println("[INFO] Set the environment variable SL_ROUTE_DESTINATION for testing ibm_is_vpc_route else it is set to default value '192.168.4.0/24'") - } - ISRouteNextHop = os.Getenv("SL_ROUTE_NEXTHOP") if ISRouteNextHop == "" { ISRouteNextHop = "10.240.0.0" - fmt.Println("[INFO] Set the environment variable SL_ROUTE_NEXTHOP for testing ibm_is_vpc_route else it is set to default value '10.0.0.4'") + fmt.Println("[INFO] Set the environment variable SL_ROUTE_NEXTHOP else it is set to default value '10.0.0.4'") } IcdDbRegion = os.Getenv("ICD_DB_REGION") diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 8dbfd8e4b1..a5662da97a 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -1001,7 +1001,6 @@ func Provider() *schema.Provider { "ibm_is_vpn_gateway_connection": vpc.ResourceIBMISVPNGatewayConnection(), "ibm_is_vpc": vpc.ResourceIBMISVPC(), "ibm_is_vpc_address_prefix": vpc.ResourceIBMISVpcAddressPrefix(), - "ibm_is_vpc_route": vpc.ResourceIBMISVpcRoute(), "ibm_is_vpc_routing_table": vpc.ResourceIBMISVPCRoutingTable(), "ibm_is_vpc_routing_table_route": vpc.ResourceIBMISVPCRoutingTableRoute(), "ibm_is_vpn_server": vpc.ResourceIBMIsVPNServer(), @@ -1384,7 +1383,6 @@ func Validator() validate.ValidatorDict { "ibm_is_subnet_reserved_ip": vpc.ResourceIBMISSubnetReservedIPValidator(), "ibm_is_volume": vpc.ResourceIBMISVolumeValidator(), "ibm_is_address_prefix": vpc.ResourceIBMISAddressPrefixValidator(), - "ibm_is_route": vpc.ResourceIBMISRouteValidator(), "ibm_is_vpc": vpc.ResourceIBMISVPCValidator(), "ibm_is_vpc_routing_table": vpc.ResourceIBMISVPCRoutingTableValidator(), "ibm_is_vpc_routing_table_route": vpc.ResourceIBMISVPCRoutingTableRouteValidator(), diff --git a/ibm/service/vpc/resource_ibm_is_vpc_address_prefix.go b/ibm/service/vpc/resource_ibm_is_vpc_address_prefix.go index c9a1348cc9..85537ebbc7 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_address_prefix.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_address_prefix.go @@ -101,13 +101,6 @@ func ResourceIBMISAddressPrefixValidator() *validate.ResourceValidator { Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`, MinValueLength: 1, MaxValueLength: 63}) - validateSchema = append(validateSchema, - validate.ValidateSchema{ - Identifier: isVPCRouteDestinationCIDR, - ValidateFunctionIdentifier: validate.ValidateCIDRAddress, - Type: validate.TypeString, - ForceNew: true, - Required: true}) validateSchema = append(validateSchema, validate.ValidateSchema{ Identifier: isVPCAddressPrefixCIDR, diff --git a/ibm/service/vpc/resource_ibm_is_vpc_route.go b/ibm/service/vpc/resource_ibm_is_vpc_route.go deleted file mode 100644 index 964b11a8ad..0000000000 --- a/ibm/service/vpc/resource_ibm_is_vpc_route.go +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright IBM Corp. 2017, 2021 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package vpc - -import ( - "fmt" - "log" - "time" - - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" - "github.com/IBM/vpc-go-sdk/vpcv1" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -const ( - isVPCRouteName = "name" - isVPCRouteState = "status" - isVPCRouteNextHop = "next_hop" - isVPCRouteDestinationCIDR = "destination" - isVPCRouteLocation = "zone" - isVPCRouteVPCID = "vpc" - - isRouteStatusPending = "pending" - isRouteStatusUpdating = "updating" - isRouteStatusStable = "stable" - isRouteStatusFailed = "failed" - - isRouteStatusDeleting = "deleting" - isRouteStatusDeleted = "deleted" -) - -func ResourceIBMISVpcRoute() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: "Resource Removal: Resource ibm_is_vpc_route is deprecated and being removed. Use ibm_is_vpc_routing_table_route for creating routes for VPC routing table.\n This resource will not be available from next release (v1.52.0).", - Create: resourceIBMISVpcRouteCreate, - Read: resourceIBMISVpcRouteRead, - Update: resourceIBMISVpcRouteUpdate, - Delete: resourceIBMISVpcRouteDelete, - Exists: resourceIBMISVpcRouteExists, - Importer: &schema.ResourceImporter{}, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), - }, - - Schema: map[string]*schema.Schema{ - isVPCRouteName: { - Type: schema.TypeString, - Required: true, - ForceNew: false, - ValidateFunc: validate.InvokeValidator("ibm_is_route", isVPCRouteName), - Description: "VPC route name", - }, - isVPCRouteLocation: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "VPC route location", - }, - - isVPCRouteDestinationCIDR: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.InvokeValidator("ibm_is_route", isVPCRouteDestinationCIDR), - Description: "VPC route destination CIDR value", - }, - - isVPCRouteState: { - Type: schema.TypeString, - Computed: true, - }, - - isVPCRouteVPCID: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "VPC instance ID", - }, - - isVPCRouteNextHop: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "VPC route next hop value", - }, - - flex.RelatedCRN: { - Type: schema.TypeString, - Computed: true, - Description: "The crn of the VPC resource", - }, - }, - } -} - -func ResourceIBMISRouteValidator() *validate.ResourceValidator { - - validateSchema := make([]validate.ValidateSchema, 0) - validateSchema = append(validateSchema, - validate.ValidateSchema{ - Identifier: isVPCRouteName, - ValidateFunctionIdentifier: validate.ValidateRegexpLen, - Type: validate.TypeString, - Required: true, - Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`, - MinValueLength: 1, - MaxValueLength: 63}) - validateSchema = append(validateSchema, - validate.ValidateSchema{ - Identifier: isVPCRouteDestinationCIDR, - ValidateFunctionIdentifier: validate.ValidateCIDRAddress, - Type: validate.TypeString, - ForceNew: true, - Required: true}) - - ibmISRouteResourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_route", Schema: validateSchema} - return &ibmISRouteResourceValidator -} - -func resourceIBMISVpcRouteCreate(d *schema.ResourceData, meta interface{}) error { - - routeName := d.Get(isVPCRouteName).(string) - zoneName := d.Get(isVPCRouteLocation).(string) - cidr := d.Get(isVPCRouteDestinationCIDR).(string) - vpcID := d.Get(isVPCRouteVPCID).(string) - nextHop := d.Get(isVPCRouteNextHop).(string) - err := vpcRouteCreate(d, meta, routeName, zoneName, cidr, vpcID, nextHop) - if err != nil { - return err - } - return resourceIBMISVpcRouteRead(d, meta) -} - -func vpcRouteCreate(d *schema.ResourceData, meta interface{}, routeName, zoneName, cidr, vpcID, nextHop string) error { - sess, err := vpcClient(meta) - if err != nil { - return err - } - createRouteOptions := &vpcv1.CreateVPCRouteOptions{ - VPCID: &vpcID, - Destination: &cidr, - Name: &routeName, - NextHop: &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ - Address: &nextHop, - }, - Zone: &vpcv1.ZoneIdentity{ - Name: &zoneName, - }, - } - route, response, err := sess.CreateVPCRoute(createRouteOptions) - if err != nil { - return fmt.Errorf("[ERROR] Error while creating VPC Route err %s\n%s", err, response) - } - routeID := *route.ID - - d.SetId(fmt.Sprintf("%s/%s", vpcID, routeID)) - - _, err = isWaitForRouteStable(sess, d, vpcID, routeID) - if err != nil { - return err - } - return nil -} - -func isWaitForRouteStable(sess *vpcv1.VpcV1, d *schema.ResourceData, vpcID, routeID string) (interface{}, error) { - - stateConf := &resource.StateChangeConf{ - Pending: []string{isRouteStatusPending, isRouteStatusUpdating}, - Target: []string{isRouteStatusStable, isRouteStatusFailed}, - Refresh: func() (interface{}, string, error) { - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - route, response, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - return route, "", fmt.Errorf("[ERROR] Error Getting VPC Route: %s\n%s", err, response) - } - - if *route.LifecycleState == "stable" || *route.LifecycleState == "failed" { - return route, *route.LifecycleState, nil - } - return route, *route.LifecycleState, nil - }, - Timeout: d.Timeout(schema.TimeoutCreate), - Delay: 10 * time.Second, - MinTimeout: 10 * time.Second, - } - - return stateConf.WaitForState() -} - -func resourceIBMISVpcRouteRead(d *schema.ResourceData, meta interface{}) error { - - parts, err := flex.IdParts(d.Id()) - if err != nil { - return err - } - - vpcID := parts[0] - routeID := parts[1] - error := vpcRouteGet(d, meta, vpcID, routeID) - if error != nil { - return error - } - return nil -} - -func vpcRouteGet(d *schema.ResourceData, meta interface{}, vpcID, routeID string) error { - sess, err := vpcClient(meta) - if err != nil { - return err - } - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - route, response, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - d.SetId("") - return nil - } - return fmt.Errorf("[ERROR] Error Getting VPC Route (%s): %s\n%s", routeID, err, response) - } - d.Set(isVPCRouteVPCID, vpcID) - d.Set(isVPCRouteName, route.Name) - if route.Zone != nil { - d.Set(isVPCRouteLocation, *route.Zone.Name) - } - d.Set(isVPCRouteDestinationCIDR, *route.Destination) - nexthop := route.NextHop.(*vpcv1.RouteNextHop) - d.Set(isVPCRouteNextHop, *nexthop.Address) - d.Set(isVPCRouteState, *route.LifecycleState) - getVPCOptions := &vpcv1.GetVPCOptions{ - ID: &vpcID, - } - vpc, response, err := sess.GetVPC(getVPCOptions) - if err != nil { - return fmt.Errorf("[ERROR] Error Getting VPC : %s\n%s", err, response) - } - d.Set(flex.RelatedCRN, *vpc.CRN) - - return nil -} - -func resourceIBMISVpcRouteUpdate(d *schema.ResourceData, meta interface{}) error { - - name := "" - hasChanged := false - - parts, err := flex.IdParts(d.Id()) - if err != nil { - return err - } - - vpcID := parts[0] - routeID := parts[1] - if d.HasChange(isVPCRouteName) { - name = d.Get(isVPCRouteName).(string) - hasChanged = true - } - - error := vpcRouteUpdate(d, meta, vpcID, routeID, name, hasChanged) - if error != nil { - return error - } - - return resourceIBMISVpcRouteRead(d, meta) -} - -func vpcRouteUpdate(d *schema.ResourceData, meta interface{}, vpcID, routeID, name string, hasChanged bool) error { - sess, err := vpcClient(meta) - if err != nil { - return err - } - if hasChanged { - updateVpcRouteOptions := &vpcv1.UpdateVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - routePatchModel := &vpcv1.RoutePatch{ - Name: &name, - } - routePatch, err := routePatchModel.AsPatch() - if err != nil { - return fmt.Errorf("[ERROR] Error calling asPatch for RoutePatch: %s", err) - } - updateVpcRouteOptions.RoutePatch = routePatch - _, response, err := sess.UpdateVPCRoute(updateVpcRouteOptions) - if err != nil { - return fmt.Errorf("[ERROR] Error Updating VPC Route: %s\n%s", err, response) - } - } - return nil -} - -func resourceIBMISVpcRouteDelete(d *schema.ResourceData, meta interface{}) error { - parts, err := flex.IdParts(d.Id()) - if err != nil { - return err - } - vpcID := parts[0] - routeID := parts[1] - error := vpcRouteDelete(d, meta, vpcID, routeID) - if error != nil { - return error - } - - d.SetId("") - return nil -} - -func vpcRouteDelete(d *schema.ResourceData, meta interface{}, vpcID, routeID string) error { - sess, err := vpcClient(meta) - if err != nil { - return err - } - - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - _, response, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - return nil - } - return fmt.Errorf("[ERROR] Error Getting VPC Route (%s): %s\n%s", routeID, err, response) - } - deleteRouteOptions := &vpcv1.DeleteVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - response, err = sess.DeleteVPCRoute(deleteRouteOptions) - if err != nil { - return fmt.Errorf("[ERROR] Error Deleting VPC Route: %s\n%s", err, response) - } - _, err = isWaitForVPCRouteDeleted(sess, vpcID, routeID, d.Timeout(schema.TimeoutDelete)) - if err != nil { - return err - } - d.SetId("") - return nil -} - -func isWaitForVPCRouteDeleted(sess *vpcv1.VpcV1, vpcID, routeID string, timeout time.Duration) (interface{}, error) { - - log.Printf("Waiting for VPC Route (%s) to be deleted.", routeID) - stateConf := &resource.StateChangeConf{ - Pending: []string{"retry", isRouteStatusDeleting}, - Target: []string{isRouteStatusDeleted, isRouteStatusFailed}, - Refresh: func() (interface{}, string, error) { - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - route, response, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - return route, isRouteStatusDeleted, nil - } - return route, isRouteStatusDeleting, fmt.Errorf("[ERROR] The VPC route %s failed to delete: %s\n%s", routeID, err, response) - } - return route, isRouteStatusDeleting, nil - }, - Timeout: timeout, - Delay: 10 * time.Second, - MinTimeout: 10 * time.Second, - } - - return stateConf.WaitForState() -} - -func resourceIBMISVpcRouteExists(d *schema.ResourceData, meta interface{}) (bool, error) { - parts, err := flex.IdParts(d.Id()) - if err != nil { - return false, err - } - if len(parts) != 2 { - return false, fmt.Errorf("[ERROR] Incorrect ID %s: ID should be a combination of vpcID/routeID", d.Id()) - } - vpcID := parts[0] - routeID := parts[1] - exists, err := vpcRouteExists(d, meta, vpcID, routeID) - return exists, err -} - -func vpcRouteExists(d *schema.ResourceData, meta interface{}, vpcID, routeID string) (bool, error) { - sess, err := vpcClient(meta) - if err != nil { - return false, err - } - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - _, response, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - if response != nil && response.StatusCode == 404 { - return false, nil - } - return false, fmt.Errorf("[ERROR] Error getting VPC Route: %s\n%s", err, response) - } - return true, nil -} diff --git a/ibm/service/vpc/resource_ibm_is_vpc_route_test.go b/ibm/service/vpc/resource_ibm_is_vpc_route_test.go deleted file mode 100644 index 596daa8de8..0000000000 --- a/ibm/service/vpc/resource_ibm_is_vpc_route_test.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright IBM Corp. 2017, 2021 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package vpc_test - -import ( - "errors" - "fmt" - "testing" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - - "github.com/IBM/vpc-go-sdk/vpcv1" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccIBMISVPCRoute_basic(t *testing.T) { - var vpcRoute string - name1 := fmt.Sprintf("tfvpcuat-create-%d", acctest.RandIntRange(10, 100)) - subnetName := fmt.Sprintf("tfsubnet-%d", acctest.RandIntRange(10, 100)) - routeName := fmt.Sprintf("tfvpcuat-create-%d", acctest.RandIntRange(10, 100)) - routeName1 := fmt.Sprintf("tfvpcuat-create-%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIBMISVPCRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccCheckIBMISVPCRouteConfig(name1, subnetName, routeName), - Check: resource.ComposeTestCheckFunc( - testAccCheckIBMISVPCRouteExists("ibm_is_vpc_route.testacc_vpc_route", vpcRoute), - resource.TestCheckResourceAttr( - "ibm_is_vpc_route.testacc_vpc_route", "name", routeName), - ), - }, - { - Config: testAccCheckIBMISVPCRouteConfig(name1, subnetName, routeName1), - Check: resource.ComposeTestCheckFunc( - testAccCheckIBMISVPCRouteExists("ibm_is_vpc_route.testacc_vpc_route", vpcRoute), - resource.TestCheckResourceAttr( - "ibm_is_vpc_route.testacc_vpc_route", "name", routeName1), - ), - }, - }, - }) -} - -func testAccCheckIBMISVPCRouteDestroy(s *terraform.State) error { - sess, _ := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() - for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_is_vpc_route" { - continue - } - parts, err := flex.IdParts(rs.Primary.ID) - if err != nil { - return err - } - - vpcID := parts[0] - routeID := parts[1] - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - _, _, err1 := sess.GetVPCRoute(getVpcRouteOptions) - - if err1 == nil { - return fmt.Errorf("vpc route still exists: %s", rs.Primary.ID) - } - } - return nil -} - -func testAccCheckIBMISVPCRouteExists(n, vpcrouteID string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return errors.New("No Record ID is set") - } - - parts, err := flex.IdParts(rs.Primary.ID) - if err != nil { - return err - } - - vpcID := parts[0] - routeID := parts[1] - - sess, _ := acc.TestAccProvider.Meta().(conns.ClientSession).VpcV1API() - getVpcRouteOptions := &vpcv1.GetVPCRouteOptions{ - VPCID: &vpcID, - ID: &routeID, - } - foundroute, _, err := sess.GetVPCRoute(getVpcRouteOptions) - if err != nil { - return err - } - vpcrouteID = *foundroute.ID - return nil - } -} - -func testAccCheckIBMISVPCRouteConfig(name, subnetName, routeName string) string { - return fmt.Sprintf(` -resource "ibm_is_vpc" "testacc_vpc" { - name = "%s" -} - -resource "ibm_is_subnet" "testacc_subnet" { - name = "%s" - vpc = ibm_is_vpc.testacc_vpc.id - zone = "%s" - ipv4_cidr_block = "%s" -} - -resource "ibm_is_vpc_route" "testacc_vpc_route" { - name = "%s" - zone = "%s" - vpc = ibm_is_vpc.testacc_vpc.id - destination = "%s" - next_hop = "%s" - depends_on = [ibm_is_subnet.testacc_subnet] -}`, name, subnetName, acc.ISZoneName, acc.ISCIDR, routeName, acc.ISZoneName, acc.ISRouteDestination, acc.ISRouteNextHop) -} diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway.go index a01ce2df89..86f9635ead 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway.go @@ -71,7 +71,7 @@ func ResourceIBMISVPNGateway() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: false, - ValidateFunc: validate.InvokeValidator("ibm_is_route", isVPNGatewayName), + ValidateFunc: validate.InvokeValidator("ibm_is_vpn_gateway", isVPNGatewayName), Description: "VPN Gateway instance name", }, diff --git a/website/docs/r/is_vpc_route.html.markdown b/website/docs/r/is_vpc_route.html.markdown deleted file mode 100644 index c1c5e34d3f..0000000000 --- a/website/docs/r/is_vpc_route.html.markdown +++ /dev/null @@ -1,74 +0,0 @@ ---- - -subcategory: "VPC infrastructure" -layout: "ibm" -page_title: "IBM : vpc-route" -description: |- - Manages IBM IS VPC route. ---- - -!> **Removal Notification** Resource `ibm_is_vpc_route` support will be stopped by terraform provider from `v1.52.0`; [releases](https://github.com/IBM-Cloud/terraform-provider-ibm/releases/), recommendation is to use `ibm_is_vpc_routing_table_route` instead.
-**Documentation** on `ibm_is_vpc_routing_table_route` can be found [here](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/is_vpc_routing_table_route) - - -# ibm_is_vpc_route -Create, update, or delete a VPC route. For more information, about VPC routes, see [setting up advanced routing in VPC](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes). - -**Note:** -VPC infrastructure services are a regional specific based endpoint, by default targets to `us-south`. Please make sure to target right region in the provider block as shown in the `provider.tf` file, if VPC service is created in region other than `us-south`. - -**provider.tf** - -```terraform -provider "ibm" { - region = "eu-gb" -} -``` - -## Example usage - -```terraform -resource "ibm_is_vpc" "example" { - name = "example-vpc" -} - -resource "ibm_is_vpc_route" "example" { - name = "example-route" - vpc = ibm_is_vpc.example.id - zone = "us-south-1" - destination = "192.168.4.0/24" - next_hop = "10.0.0.4" -} - -``` - -## Timeouts -The `ibm_is_vpc_route` resource provides the following [Timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: - -- **create**: The creation of the route is considered `failed` when no response is received for 10 minutes. -- **delete**: The deletion of the route is considered `failed` when no response is received for 10 minutes. - - -## Argument reference -Review the argument references that you can specify for your resource. - -- `destination` - (Required, Forces new resource, String) The destination IP address or CIDR that network traffic from your VPC must match to be routed to the `next_hop`. -- `name` - (Required, String) The name of the route that you want to create. -- `next_hop` - (Required, String) The IP address where network traffic is sent next. -- `vpc` - (Required, Forces new resource, String) The ID of the VPC where you want to create the route. -- `zone` - (Required, Forces new resource, String) The name of the VPC zone where you want to create the route. - -## Attribute reference -In addition to all argument reference list, you can access the following attribute reference after your resource is created. - -- `id` - (String) The ID of the VPC route. The ID is composed of `/`. -- `status` - (String) The status of the VPC route. - -## Import -The `ibm_is_vpc_route` resource can be imported by using the VPC and route IDs. - -**Syntax** - -``` -$ terraform import ibm_is_vpc_route.example / -```