Skip to content

Commit

Permalink
Output parameter added : default_routing_table
Browse files Browse the repository at this point in the history
enhancement : added an output parameter returning the default routing table id
  • Loading branch information
ujjwal-ibm committed Mar 2, 2021
1 parent a983b2b commit 9b046b4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ibm/data_source_ibm_is_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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,
Expand Down Expand Up @@ -517,6 +523,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 {
Expand Down
10 changes: 10 additions & 0 deletions ibm/resource_ibm_is_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
const (
isVPCDefaultNetworkACL = "default_network_acl"
isVPCIDefaultSecurityGroup = "default_security_group"
isVPCDefaultRoutingTable = "default_routing_table"
isVPCName = "name"
isVPCResourceGroup = "resource_group"
isVPCStatus = "status"
Expand Down Expand Up @@ -89,6 +90,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,
Expand Down Expand Up @@ -796,6 +803,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(
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_vpc.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_vpc.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9b046b4

Please sign in to comment.