@@ -25,15 +25,20 @@ type agentAttributes struct {
25
25
26
26
// A mapping of attributes on the "coder_app" resource.
27
27
type agentAppAttributes struct {
28
- AgentID string `mapstructure:"agent_id"`
29
- Name string `mapstructure:"name"`
30
- Icon string `mapstructure:"icon"`
31
- URL string `mapstructure:"url"`
32
- Command string `mapstructure:"command"`
33
- RelativePath bool `mapstructure:"relative_path"`
34
- HealthcheckURL string `mapstructure:"healthcheck_url"`
35
- HealthcheckInterval int32 `mapstructure:"healthcheck_interval"`
36
- HealthcheckThreshold int32 `mapstructure:"healthcheck_threshold"`
28
+ AgentID string `mapstructure:"agent_id"`
29
+ Name string `mapstructure:"name"`
30
+ Icon string `mapstructure:"icon"`
31
+ URL string `mapstructure:"url"`
32
+ Command string `mapstructure:"command"`
33
+ RelativePath bool `mapstructure:"relative_path"`
34
+ Healthcheck * appHealthcheckAttributes `mapstructure:"healthcheck"`
35
+ }
36
+
37
+ // A mapping of attributes on the "healthcheck" resource.
38
+ type appHealthcheckAttributes struct {
39
+ URL string `mapstructure:"url"`
40
+ Interval int32 `mapstructure:"interval"`
41
+ Threshold int32 `mapstructure:"threshold"`
37
42
}
38
43
39
44
// A mapping of attributes on the "coder_metadata" resource.
@@ -221,6 +226,14 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res
221
226
// Default to the resource name if none is set!
222
227
attrs .Name = resource .Name
223
228
}
229
+ var healthcheck * proto.Healthcheck
230
+ if attrs .Healthcheck != nil {
231
+ healthcheck = & proto.Healthcheck {
232
+ Url : attrs .Healthcheck .URL ,
233
+ Interval : attrs .Healthcheck .Interval ,
234
+ Threshold : attrs .Healthcheck .Threshold ,
235
+ }
236
+ }
224
237
for _ , agents := range resourceAgents {
225
238
for _ , agent := range agents {
226
239
// Find agents with the matching ID and associate them!
@@ -233,11 +246,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res
233
246
Url : attrs .URL ,
234
247
Icon : attrs .Icon ,
235
248
RelativePath : attrs .RelativePath ,
236
- Healthcheck : & proto.Healthcheck {
237
- Url : attrs .HealthcheckURL ,
238
- Interval : attrs .HealthcheckInterval ,
239
- Threshold : attrs .HealthcheckThreshold ,
240
- },
249
+ Healthcheck : healthcheck ,
241
250
})
242
251
}
243
252
}
0 commit comments