Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thepalbi committed Sep 27, 2024
1 parent 3ec3253 commit f083895
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions internal/resources/cloud/resource_cloud_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,13 @@ func readStack(ctx context.Context, d *schema.ResourceData, client *gcom.APIClie
return common.WarnMissing("stack", d)
}

if err := flattenStack(d, stack); err != nil {
connectionsReq := client.InstancesAPI.GetConnections(ctx, id.(string))
connections, _, err := connectionsReq.Execute()
if err != nil {
return apiError(err)
}

if err := flattenStack(d, stack, connections); err != nil {
return diag.FromErr(err)
}
// Always set the wait attribute to true after creation
Expand All @@ -355,7 +361,7 @@ func readStack(ctx context.Context, d *schema.ResourceData, client *gcom.APIClie
return nil
}

func flattenStack(d *schema.ResourceData, stack *gcom.FormattedApiInstance) error {
func flattenStack(d *schema.ResourceData, stack *gcom.FormattedApiInstance, connections *gcom.FormattedApiInstanceConnections) error {
id := strconv.FormatInt(int64(stack.Id), 10)
d.SetId(id)
d.Set("name", stack.Name)
Expand Down Expand Up @@ -410,6 +416,14 @@ func flattenStack(d *schema.ResourceData, stack *gcom.FormattedApiInstance) erro
d.Set("graphite_url", stack.HmInstanceGraphiteUrl)
d.Set("graphite_status", stack.HmInstanceGraphiteStatus)

if otlpURL := connections.OtlpHttpUrl; otlpURL.IsSet() {
d.Set("otlp_url", otlpURL.Get())
}

if influxURL := connections.InfluxUrl; influxURL.IsSet() {
d.Set("influx_url", influxURL.Get())
}

return nil
}

Expand Down

0 comments on commit f083895

Please sign in to comment.