diff --git a/ibm/service/resourcecontroller/data_source_ibm_resource_instance.go b/ibm/service/resourcecontroller/data_source_ibm_resource_instance.go index f0dcc93c43..caf7896750 100644 --- a/ibm/service/resourcecontroller/data_source_ibm_resource_instance.go +++ b/ibm/service/resourcecontroller/data_source_ibm_resource_instance.go @@ -4,6 +4,7 @@ package resourcecontroller import ( + "encoding/json" "fmt" "log" "net/url" @@ -84,6 +85,12 @@ func DataSourceIBMResourceInstance() *schema.Resource { Description: "Guid of resource instance", }, + "parameters_json": { + Description: "Parameters asociated with instance in json string", + Type: schema.TypeString, + Computed: true, + }, + flex.ResourceName: { Type: schema.TypeString, Computed: true, @@ -246,6 +253,15 @@ func DataSourceIBMResourceInstanceRead(d *schema.ResourceData, meta interface{}) d.Set(flex.ResourceName, instance.Name) d.Set(flex.ResourceCRN, instance.CRN) d.Set(flex.ResourceStatus, instance.State) + if instance.Parameters != nil { + params, err := json.Marshal(instance.Parameters) + if err != nil { + return fmt.Errorf("[ERROR] Error marshalling instance parameters: %s", err) + } + if err = d.Set("parameters_json", string(params)); err != nil { + return fmt.Errorf("[ERROR] Error setting instance parameters json: %s", err) + } + } rMgtClient, err := meta.(conns.ClientSession).ResourceManagerV2API() if err != nil { return err diff --git a/website/docs/d/resource_instance.html.markdown b/website/docs/d/resource_instance.html.markdown index c24ecf6848..ba6cbbc1c0 100644 --- a/website/docs/d/resource_instance.html.markdown +++ b/website/docs/d/resource_instance.html.markdown @@ -40,5 +40,6 @@ In addition to all argument reference list, you can access the following attribu - `extensions` - (String) The extended metadata as a map associated with the resource instance. - `guid`- (String) The GUID of the resource instance. - `id` - (String) The unique identifier of the resource instance. +- `parameters_json` - (String) The parameters associated with the instance in json format. - `plan` - (String) The plan for the service offering used by this resource instance. - `status` - (String) The status of resource instance.