Skip to content

Commit 99c5fde

Browse files
committed
Expose via API
1 parent 85bc72f commit 99c5fde

File tree

6 files changed

+234
-2
lines changed

6 files changed

+234
-2
lines changed

coderd/apidoc/docs.go

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq
386386
}
387387

388388
for _, templateVariable := range request.TemplateVariables {
389-
server.Logger.Debug(ctx, "insert template variable", slog.F("template_version_id", templateVersion.ID), slog.F("template_variable", templateVariable))
389+
server.Logger.Info(ctx, "insert template variable", slog.F("template_version_id", templateVersion.ID), slog.F("template_variable", templateVariable))
390390

391391
_, err = server.Database.InsertTemplateVersionVariable(ctx, database.InsertTemplateVersionVariableParams{
392392
TemplateVersionID: templateVersion.ID,

docs/api/schemas.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4611,6 +4611,40 @@ Parameter represents a set value for the scope.
46114611
| `name` | string | false | | |
46124612
| `value` | string | false | | |
46134613

4614+
## codersdk.TemplateVersionVariable
4615+
4616+
```json
4617+
{
4618+
"default_value": "string",
4619+
"description": "string",
4620+
"name": "string",
4621+
"required": true,
4622+
"sensitive": true,
4623+
"type": "string",
4624+
"value": "string"
4625+
}
4626+
```
4627+
4628+
### Properties
4629+
4630+
| Name | Type | Required | Restrictions | Description |
4631+
| --------------- | ------- | -------- | ------------ | ----------- |
4632+
| `default_value` | string | false | | |
4633+
| `description` | string | false | | |
4634+
| `name` | string | false | | |
4635+
| `required` | boolean | false | | |
4636+
| `sensitive` | boolean | false | | |
4637+
| `type` | string | false | | |
4638+
| `value` | string | false | | |
4639+
4640+
#### Enumerated Values
4641+
4642+
| Property | Value |
4643+
| -------- | -------- |
4644+
| `type` | `string` |
4645+
| `type` | `number` |
4646+
| `type` | `bool` |
4647+
46144648
## codersdk.TraceConfig
46154649

46164650
```json

docs/api/templates.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,3 +2246,71 @@ Status Code **200**
22462246
| `default_source_scheme` | `data` |
22472247

22482248
To perform this operation, you must be authenticated. [Learn more](authentication.md).
2249+
2250+
## Get template variables by template version
2251+
2252+
### Code samples
2253+
2254+
```shell
2255+
# Example request using curl
2256+
curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/variables \
2257+
-H 'Accept: application/json' \
2258+
-H 'Coder-Session-Token: API_KEY'
2259+
```
2260+
2261+
`GET /templateversions/{templateversion}/variables`
2262+
2263+
### Parameters
2264+
2265+
| Name | In | Type | Required | Description |
2266+
| ----------------- | ---- | ------------ | -------- | ------------------- |
2267+
| `templateversion` | path | string(uuid) | true | Template version ID |
2268+
2269+
### Example responses
2270+
2271+
> 200 Response
2272+
2273+
```json
2274+
[
2275+
{
2276+
"default_value": "string",
2277+
"description": "string",
2278+
"name": "string",
2279+
"required": true,
2280+
"sensitive": true,
2281+
"type": "string",
2282+
"value": "string"
2283+
}
2284+
]
2285+
```
2286+
2287+
### Responses
2288+
2289+
| Status | Meaning | Description | Schema |
2290+
| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------- |
2291+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.TemplateVersionVariable](schemas.md#codersdktemplateversionvariable) |
2292+
2293+
<h3 id="get-template-variables-by-template-version-responseschema">Response Schema</h3>
2294+
2295+
Status Code **200**
2296+
2297+
| Name | Type | Required | Restrictions | Description |
2298+
| ----------------- | ------- | -------- | ------------ | ----------- |
2299+
| `[array item]` | array | false | | |
2300+
| `» default_value` | string | false | | |
2301+
| `» description` | string | false | | |
2302+
| `» name` | string | false | | |
2303+
| `» required` | boolean | false | | |
2304+
| `» sensitive` | boolean | false | | |
2305+
| `» type` | string | false | | |
2306+
| `» value` | string | false | | |
2307+
2308+
#### Enumerated Values
2309+
2310+
| Property | Value |
2311+
| -------- | -------- |
2312+
| `type` | `string` |
2313+
| `type` | `number` |
2314+
| `type` | `bool` |
2315+
2316+
To perform this operation, you must be authenticated. [Learn more](authentication.md).

provisioner/terraform/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (*server) Parse(request *proto.Parse_Request, stream proto.DRPCProvisioner_
6767
var templateVariables []*proto.TemplateVariable
6868

6969
useManagedVariables := flags != nil && flags[featureUseManagedVariables]
70-
if useManagedVariables {
70+
if useManagedVariables || true { // FIXME
7171
for _, v := range variables {
7272
mv, err := convertTerraformVariableToManagedVariable(v)
7373
if err != nil {

0 commit comments

Comments
 (0)