Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added advertised route support #250

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Merge branch 'master' into vpc-advertise-routes
sreekarbvibm committed Jul 25, 2023
commit 79c8505427b20688cb77e2ffe7f78b995ba20827
14 changes: 11 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -28,8 +28,9 @@ require (
github.com/IBM/scc-go-sdk/v3 v3.1.6
github.com/IBM/scc-go-sdk/v4 v4.0.2
github.com/IBM/schematics-go-sdk v0.2.1
github.com/IBM/secrets-manager-go-sdk v0.1.19
github.com/IBM/vpc-go-sdk v0.31.0
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.0
github.com/IBM/vpc-beta-go-sdk v0.5.0
github.com/IBM/vpc-go-sdk v0.40.0
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/Shopify/sarama v1.29.1
github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105
@@ -226,4 +227,11 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay
replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible

// add sdk changes.
replace github.com/IBM/vpc-go-sdk v0.31.0 => ./common/github.com/vpc-go-sdk
replace github.com/IBM/vpc-go-sdk v0.40.0 => ./common/github.com/vpc-go-sdk
replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7

exclude (
github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/client-go v12.0.0+incompatible
)
36 changes: 24 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
@@ -94,8 +94,12 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/IBM-Cloud/bluemix-go v0.0.0-20230120122421-afb48116b8f1 h1:5cVMU5MglJjwzoBsDOk3yuH6T/1EeDZyYbQDowL4nW8=
github.com/IBM-Cloud/bluemix-go v0.0.0-20230120122421-afb48116b8f1/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/IBM-Cloud/bluemix-go v0.0.0-20230601050310-eecebfbff63e h1:0GNM+YmWoFcq8/cih+oZAv+cdvNt8ZdFO807QbBzm1Y=
github.com/IBM-Cloud/bluemix-go v0.0.0-20230601050310-eecebfbff63e/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230118060037-101bda076037 h1:C1gOsj2A5ouRUXrmKHebXjs4FXRE8ApMUC3GBUpd9Co=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20230118060037-101bda076037/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
@@ -113,12 +117,16 @@ github.com/IBM/cloud-databases-go-sdk v0.3.2 h1:AUi7/xswqCwuXIlSyuXtDZJIm4d0ZicU
github.com/IBM/cloud-databases-go-sdk v0.3.2/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M=
github.com/IBM/cloudant-go-sdk v0.0.43 h1:YxTy4RpAEezX32YIWnds76hrBREmO4u6IkBz1WylNuQ=
github.com/IBM/cloudant-go-sdk v0.0.43/go.mod h1:WeYrJPaHTw19943ndWnVfwMIlZ5z0XUM2uEXNBrwZ1M=
github.com/IBM/container-registry-go-sdk v0.0.15 h1:sfEXm4qNj9ZCwTlFOsdjF5P/lvajU/Sc22yNlzg0F9I=
github.com/IBM/container-registry-go-sdk v0.0.15/go.mod h1:KqSZFO4VIK9QAyF8O1JW6jkyzkfE/BNKUIo+OdzIDk4=
github.com/IBM/continuous-delivery-go-sdk v1.0.4 h1:Qq6EG4dMyX6tD2HhNaMihFFEeoKXjQl2iLz3PWfyw6g=
github.com/IBM/continuous-delivery-go-sdk v1.0.4/go.mod h1:/pSji7d4POPVd1tQA9CLrNT1XMsCJMGLqOtTwXbWAdE=
github.com/IBM/event-notifications-go-admin-sdk v0.1.7 h1:PkgkYzPAd3f6jhzV89oVwQoNS6oQg/82cy2JMWO2UzA=
github.com/IBM/event-notifications-go-admin-sdk v0.1.7/go.mod h1:Lh4dp5FaW1hB5FEm2oWKqxjbCz9WonZMisNkKiVgnnE=
github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918 h1:RfHezAVs3HegiGOcMmTXqsBPqZqfwZZHqje1EMriHBQ=
github.com/IBM/code-engine-go-sdk v0.0.0-20230606173928-4863db061918/go.mod h1:IP6U/1NxgxzPeYdyiEwMaZyzelTw82JGHWl7bY78eQM=
github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTphE9Ag8ho28yXjc=
github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs=
github.com/IBM/continuous-delivery-go-sdk v1.1.1 h1:bYrK0+rJgoWfBmIJAlAfo/AxI5vOr8DSLJPrM3iEOzQ=
github.com/IBM/continuous-delivery-go-sdk v1.1.1/go.mod h1:A9rI1HPbccBBFgwJxXB999yXXpj1l+MnlE+rsxKtxw0=
github.com/IBM/event-notifications-go-admin-sdk v0.2.2 h1:Aww+OUcKgsbXyY7a/nlMH7nvZGn0sBTr6p6rUjOyy1Y=
github.com/IBM/event-notifications-go-admin-sdk v0.2.2/go.mod h1:1TlGAFP47DybbovJfHtYYgSI8xpLL8Q0wao6vsAlb6c=
github.com/IBM/event-notifications-go-admin-sdk v0.2.4 h1:WWUxwrKQxvExEK+xaAQOs6gP54LvJDPi3KatDTMfwh0=
github.com/IBM/event-notifications-go-admin-sdk v0.2.4/go.mod h1:1TlGAFP47DybbovJfHtYYgSI8xpLL8Q0wao6vsAlb6c=
github.com/IBM/eventstreams-go-sdk v1.2.0 h1:eP0afHArMGjwhGqvZAhhu/3EDKRch2JehpveqF1TUjs=
github.com/IBM/eventstreams-go-sdk v1.2.0/go.mod h1:2tuAxaYLctfqfr5jvyqSrxxEQGMwYPm3yJGWSj85YVQ=
github.com/IBM/go-sdk-core/v3 v3.0.0/go.mod h1:JI5NS2+iCoY/D8Oq3JNEZNA7qO42agu6fnaUmDsRcJA=
@@ -159,10 +167,14 @@ github.com/IBM/scc-go-sdk/v4 v4.0.2 h1:8BHMRobCFurZwKaUhxWi8CdAA9+CvyzmlBOmo7KmX
github.com/IBM/scc-go-sdk/v4 v4.0.2/go.mod h1:ufqf/kBtRn3Pq/pFXF6zQGHXV2P2EzPsntw1Sw19clE=
github.com/IBM/schematics-go-sdk v0.2.1 h1:byATysGD+Z1k/wdtNqQmKALcAPjgSLuSyzcabh1jRAw=
github.com/IBM/schematics-go-sdk v0.2.1/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
github.com/IBM/secrets-manager-go-sdk v0.1.19 h1:0GPs5EoTaWNsjo4QPj64GNxlWfN8VHJy4RDFLqddSe8=
github.com/IBM/secrets-manager-go-sdk v0.1.19/go.mod h1:eO3dBhzPrHkkt+yPex/jB2xD6qHZxBko+Aw+0tfqHeA=
github.com/IBM/vpc-go-sdk v0.31.0 h1:MFF9dtuKQMVqBvsaDMpR5SKxVuvWyOCfY74lCdg5aAA=
github.com/IBM/vpc-go-sdk v0.31.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.0 h1:Lx4Bvim/MfoHEYR+n312bty5DirAJypBGGS9YZo3zCw=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.0/go.mod h1:jagqWmjZ0zUEqh5jdGB42ApSQS40fu2LWw6pdg8JJko=
github.com/IBM/vpc-beta-go-sdk v0.5.0 h1:FfhidOZ6qlINsxvVHVZeMK2JzRld64iK3fHpUwX/vx8=
github.com/IBM/vpc-beta-go-sdk v0.5.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA=
github.com/IBM/vpc-go-sdk v0.40.0 h1:p4E1dIQc6+WmqLwRTzgWA2udqFw6nypOg+8R0WxTgX0=
github.com/IBM/vpc-go-sdk v0.40.0/go.mod h1:MgZrbITC067AlcE5oy4hwylasFvrePL4RVxeF6GTdKQ=
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
17 changes: 17 additions & 0 deletions ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go
Original file line number Diff line number Diff line change
@@ -354,6 +354,23 @@ func resourceIBMISVPCRoutingTableRouteUpdate(d *schema.ResourceData, meta interf
}

routePatchModelAsPatch, patchErr := routePatchModel.AsPatch()
hasChange := false
routePatch := make(map[string]interface{})
updateVpcRoutingTableRouteOptions := sess.NewUpdateVPCRoutingTableRouteOptions(idSet[0], idSet[1], idSet[2], routePatch)

// Construct an instance of the RoutePatch model
routePatchModel := new(vpcv1.RoutePatch)
if d.HasChange(rName) {
name := d.Get(rName).(string)
routePatchModel.Name = &name
hasChange = true
}
if d.HasChange("priority") {
rp := d.Get("priority").(int)
routePriority := int64(rp)
routePatchModel.Priority = &routePriority
hasChange = true
}

if d.HasChange(rNextHop) {
if add, ok := d.GetOk(rNextHop); ok {
19 changes: 16 additions & 3 deletions website/docs/r/is_vpc_routing_table.html.markdown
Original file line number Diff line number Diff line change
@@ -39,8 +39,7 @@ resource "ibm_is_vpc_routing_table" "example" {
```

## Example usage: Advertising routes

```terraform
```
resource "ibm_is_vpc" "example" {
name = "example-vpc"
}
@@ -53,7 +52,21 @@ resource "ibm_is_vpc_routing_table" "is_vpc_routing_table_instance" {
advertise_routes_to = transit_gateway
sreekarbvibm marked this conversation as resolved.
Show resolved Hide resolved

}
```
# Example usage for accept_routes_from_resource_type
```terraform
resource "ibm_is_vpc" "example" {
name = "example-vpc"
}

resource "ibm_is_vpc_routing_table" "example" {
vpc = ibm_is_vpc.example.id
name = "example-vpc-routing-table"
route_direct_link_ingress = true
route_transit_gateway_ingress = false
route_vpc_zone_ingress = false
accept_routes_from_resource_type = ["vpn_server"]
}
```


@@ -65,7 +78,7 @@ Review the argument references that you can specify for your resource.
->**Options** An ingress source that routes can be advertised to:</br>
**&#x2022;** `direct_link` (requires `route_direct_link_ingress` be set to `true`)</br>
**&#x2022;** `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`)

- `accept_routes_from_resource_type` - (Optional, List) The resource type filter specifying the resources that may create routes in this routing table. Ex: `vpn_server`, `vpn_gateway`
- `created_at` - (Timestamp) The date and time when the routing table was created.
- `name` - (Optional, String) The routing table name.
- `route_direct_link_ingress` - (Optional, Bool) If set to **true**, the routing table is used to route traffic that originates from Direct Link to the VPC. To succeed, the VPC must not already have a routing table with the property set to **true**.
You are viewing a condensed version of this merge commit. You can view the full changes here.