Skip to content

Commit

Permalink
subscription_id column might displaying wrong value in azure_diagnost…
Browse files Browse the repository at this point in the history
…ic_setting table. Closes #98
  • Loading branch information
rajeshbal65 committed Apr 23, 2021
1 parent e28825b commit 159b0b4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion azure/table_azure_diagnostic_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package azure

import (
"context"
"strings"

"github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights"
"github.com/turbot/go-kit/types"
"github.com/turbot/steampipe-plugin-sdk/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/plugin/transform"

Expand Down Expand Up @@ -115,7 +117,7 @@ func tableAzureDiagnosticSetting(_ context.Context) *plugin.Table {
Name: "subscription_id",
Description: ColumnDescriptionSubscription,
Type: proto.ColumnType_STRING,
Transform: transform.FromField("ID").Transform(idToSubscriptionID),
Transform: transform.FromField("ID").Transform(diagnosticSettingSubscriptionID),
},
},
}
Expand Down Expand Up @@ -170,3 +172,11 @@ func getDiagnosticSetting(ctx context.Context, d *plugin.QueryData, h *plugin.Hy

return op, nil
}

//// TRANSFORM FUNCTION

func diagnosticSettingSubscriptionID(ctx context.Context, d *transform.TransformData) (interface{}, error) {
id := types.SafeString(d.Value)
subscriptionid := strings.Split(id, "/")[1]
return subscriptionid, nil
}

0 comments on commit 159b0b4

Please sign in to comment.