From 7dae0807a2a9c253804bd86fdb88a8adec1d7d67 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 19 Feb 2021 07:14:08 +0530 Subject: [PATCH] Output parameter added : default_routing_table enhancement : added an output parameter returning the default routing table id --- ibm/data_source_ibm_is_vpc.go | 9 +++++++++ ibm/resource_ibm_is_vpc.go | 10 ++++++++++ website/docs/d/is_vpc.html.markdown | 1 + website/docs/r/is_vpc.html.markdown | 1 + 4 files changed, 21 insertions(+) diff --git a/ibm/data_source_ibm_is_vpc.go b/ibm/data_source_ibm_is_vpc.go index 7c69dbc50f..5444bbd597 100644 --- a/ibm/data_source_ibm_is_vpc.go +++ b/ibm/data_source_ibm_is_vpc.go @@ -34,6 +34,12 @@ func dataSourceIBMISVPC() *schema.Resource { Computed: true, }, + isVPCDefaultRoutingTable: { + Type: schema.TypeString, + Computed: true, + Description: "Default routing table associated with VPC", + }, + isVPCName: { Type: schema.TypeString, Required: true, @@ -526,6 +532,9 @@ func vpcGetByName(d *schema.ResourceData, meta interface{}, name string) error { } else { d.Set(isVPCDefaultNetworkACL, nil) } + if vpc.DefaultRoutingTable != nil { + d.Set(isVPCDefaultRoutingTable, *vpc.DefaultRoutingTable.ID) + } if vpc.DefaultSecurityGroup != nil { d.Set(isVPCIDefaultSecurityGroup, *vpc.DefaultSecurityGroup.ID) } else { diff --git a/ibm/resource_ibm_is_vpc.go b/ibm/resource_ibm_is_vpc.go index 8f325ff625..3e4a9a8fa4 100644 --- a/ibm/resource_ibm_is_vpc.go +++ b/ibm/resource_ibm_is_vpc.go @@ -28,6 +28,7 @@ import ( const ( isVPCDefaultNetworkACL = "default_network_acl" isVPCIDefaultSecurityGroup = "default_security_group" + isVPCDefaultRoutingTable = "default_routing_table" isVPCName = "name" isVPCResourceGroup = "resource_group" isVPCStatus = "status" @@ -98,6 +99,12 @@ func resourceIBMISVPC() *schema.Resource { Description: "Default network ACL", }, + isVPCDefaultRoutingTable: { + Type: schema.TypeString, + Computed: true, + Description: "Default routing table associated with VPC", + }, + isVPCClassicAccess: { Type: schema.TypeBool, ForceNew: true, @@ -805,6 +812,9 @@ func vpcGet(d *schema.ResourceData, meta interface{}, id string) error { } else { d.Set(isVPCIDefaultSecurityGroup, nil) } + if vpc.DefaultRoutingTable != nil { + d.Set(isVPCDefaultRoutingTable, *vpc.DefaultRoutingTable.ID) + } tags, err := GetTagsUsingCRN(meta, *vpc.CRN) if err != nil { log.Printf( diff --git a/website/docs/d/is_vpc.html.markdown b/website/docs/d/is_vpc.html.markdown index eea6ca5373..7e0d79070c 100644 --- a/website/docs/d/is_vpc.html.markdown +++ b/website/docs/d/is_vpc.html.markdown @@ -38,6 +38,7 @@ The following attributes are exported: * `status` - The status of VPC. * `default_network_acl` - ID of the default network ACL. * `default_security_group` - The unique identifier of the VPC default security group. +* `default_routing_table` - The unique identifier of the VPC default routing table. * `classic_access` - Indicates whether this VPC is connected to Classic Infrastructure. * `resource_group` - The resource group ID where the VPC created. * `tags` - Tags associated with the instance. diff --git a/website/docs/r/is_vpc.html.markdown b/website/docs/r/is_vpc.html.markdown index ce95bfa675..40515948ce 100644 --- a/website/docs/r/is_vpc.html.markdown +++ b/website/docs/r/is_vpc.html.markdown @@ -48,6 +48,7 @@ The following attributes are exported: * `id` - The unique identifier of the VPC. * `crn` - The CRN of VPC. * `default_security_group` - The unique identifier of the VPC default security group. +* `default_routing_table` - The unique identifier of the VPC default routing table. * `default_network_acl` - The unique identifier of the VPC default Network ACL. * `status` - The status of VPC. * `cse_source_addresses` - A list describing the cloud service endpoint source ip adresses and zones. The nested cse_source_addresses block have the following structure: