Skip to content

Commit

Permalink
fixed connector datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfmnk committed Jul 30, 2024
1 parent 4c3ddf7 commit fd7733a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cloudconnexa/data_source_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ func dataSourceConnector() *schema.Resource {
func dataSourceConnectorRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := m.(*cloudconnexa.Client)
var diags diag.Diagnostics
connector, err := c.Connectors.GetByName(d.Get("name").(string))
name := d.Get("name").(string)
connector, err := c.Connectors.GetByName(name)
if err != nil {
return append(diags, diag.FromErr(err)...)
}
if connector == nil {
return append(diags, diag.Errorf("Connector with name %s was not found", name)...)
}

d.SetId(connector.Id)
d.Set("name", connector.Name)
d.Set("description", connector.Description)
Expand Down

0 comments on commit fd7733a

Please sign in to comment.