Skip to content

Commit

Permalink
Support: tags in resource_instance datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
kavya498 authored and hkantare committed Jun 3, 2021
1 parent 757c404 commit 57f35dd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ibm/data_source_ibm_resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package ibm

import (
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

Expand Down Expand Up @@ -61,6 +62,12 @@ func dataSourceIBMResourceInstance() *schema.Resource {
Computed: true,
Description: "CRN of resource instance",
},
"tags": {
Type: schema.TypeSet,
Computed: true,
Description: "Tags of Resource Instance",
Elem: &schema.Schema{Type: schema.TypeString},
},

"guid": {
Type: schema.TypeString,
Expand Down Expand Up @@ -210,6 +217,12 @@ func dataSourceIBMResourceInstanceRead(d *schema.ResourceData, meta interface{})
}
d.Set("plan", servicePlan)
d.Set("crn", instance.Crn.String())
tags, err := GetTagsUsingCRN(meta, instance.Crn.String())
if err != nil {
log.Printf(
"Error on get of resource instance tags (%s) tags: %s", d.Id(), err)
}
d.Set("tags", tags)

return nil
}
Expand Down

0 comments on commit 57f35dd

Please sign in to comment.