diff --git a/README.md b/README.md index 19749b908..fb7409407 100755 --- a/README.md +++ b/README.md @@ -80,7 +80,9 @@ By using the make target `make install` you can install the CSB as a local comma The mimic commands are: - `csb create-service` - creates a service instance - `csb services` - lists created service instances -- `csb update-service` - updates a serivce instance +- `csb service` - displays information on an existing service instance +- `csb update-service` - updates a service instance +- `csb upgrade-service` - upgrades a service instance - `csb delete-service` - deletes a service instance - `csb create-service-key` - creates a "binding" and prints credentials - `csb service-keys` - lists service keys diff --git a/internal/local/update_service.go b/internal/local/update_service.go index 3ae0b4a8d..166b02e4d 100644 --- a/internal/local/update_service.go +++ b/internal/local/update_service.go @@ -1,8 +1,11 @@ package local import ( + "fmt" "log" + "github.com/pivotal-cf/brokerapi/v10/domain" + "github.com/cloudfoundry/cloud-service-broker/internal/testdrive" ) @@ -11,11 +14,22 @@ func UpdateService(name, plan, params, cachePath string) { defer cleanup() serviceInstance := lookupServiceInstanceByGUID(nameToID(name)) - + deployment, err := store().GetTerraformDeployment(fmt.Sprintf("tf:%s:", serviceInstance.GUID)) + if err != nil { + log.Fatal(err) + } + tfVersion, err := deployment.TFWorkspace().StateTFVersion() + if err != nil { + log.Fatal(err) + } broker := startBroker(pakDir) defer broker.Stop() - opts := []testdrive.UpdateOption{testdrive.WithUpdateParams(params)} + opts := []testdrive.UpdateOption{ + testdrive.WithUpdateParams(params), + testdrive.WithUpdatePreviousValues(domain.PreviousValues{MaintenanceInfo: &domain.MaintenanceInfo{Version: tfVersion.String()}}), + } + if plan != "" { planID := lookupPlanIDByName(broker.Client, serviceInstance.ServiceOfferingGUID, plan) opts = append(opts, testdrive.WithUpdatePlan(planID))