Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbca4e43

Browse files
committed
feat: add inline version metadata system for resources and attributes
Implements an inline version metadata system using@SInCE:vX.Y.Z markersin resource and attribute descriptions. These markers are automaticallyextracted during doc generation to create formatted version notes.Key Features:- Inline@SInCE: markers in resource/attribute descriptions- Automatic extraction and formatting during doc generation- Version validation (semver format, >= v2.0.0)- Idempotent doc updates using HTML comment markers- Precise attribute matching to prevent false positives- Comprehensive logging for debuggingDocumentation:- Added provider/VERSION_METADATA.md with usage guidelines- Version notes link to GitHub releases- Attribute-level inline markers (since vX.Y.Z)- Markers are sanitized from final docsImplementation:- Enhanced scripts/docsgen/main.go with version processing- Validates version format and warns on issues- Uses anchored regex to prevent attribute name collisions- HTML markers enable idempotent version note updatesFixes#272
1 parente0b1ec1 commitbca4e43

24 files changed

+670
-403
lines changed

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fmt:
66
gen:
77
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
88
go run ./scripts/docsgen/...
9+
terraform fmt -recursive
910

1011
build: terraform-provider-coder
1112

‎README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ to setup your local Terraform to use your local version rather than the registry
5757
⚠️ Be sure to include`/v2` in the module path as it needs to match the version declared in the provider’s`go.mod`.
5858

5959

60+
####Documentation
61+
62+
When adding new resources or attributes, use`@since:vX.Y.Z` markers to document version requirements:
63+
64+
```go
65+
// For new resources
66+
Description:"Define a new feature. @since:v2.25.0",
67+
68+
// For new attributes
69+
"my_attribute": {
70+
Description:"New feature flag. @since:v2.25.0",
71+
}
72+
```
73+
74+
Run`make gen` to generate documentation. The markers will be automatically:
75+
- Extracted and formatted as version notes
76+
- Sanitized from the final docs
77+
- Validated for proper semver format
78+
6079
####Terraform Acceptance Tests
6180

6281
To run Terraform acceptance tests, run`make testacc`. This will test the provider against the locally installed version of Terraform.

‎docs/data-sources/external_auth.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
page_title:"coder_external_auth Data Source - terraform-provider-coder"
44
subcategory:""
55
description:|-
6-
Use this data source to require users to authenticate with an external service prior to workspace creation. This can be used to pre-authenticate external services https://coder.com/docs/admin/external-auth in a workspace. (e.g. Google Cloud, Github, Docker, etc.)
6+
Use this data source to require users to authenticate with an external service prior to workspace creation. This can be used to pre-authenticate external services https://coder.com/docs/admin/external-auth in a workspace. (e.g. Google Cloud, Github, Docker, etc.)
77
---
88

99
#coder_external_auth (Data Source)
@@ -17,12 +17,12 @@ provider "coder" {}
1717
1818
1919
data "coder_external_auth" "github" {
20-
id = "github"
20+
id = "github"
2121
}
2222
2323
data "coder_external_auth" "azure-identity" {
24-
id = "azure-identiy"
25-
optional = true
24+
id = "azure-identiy"
25+
optional = true
2626
}
2727
```
2828

‎docs/data-sources/parameter.md‎

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
page_title:"coder_parameter Data Source - terraform-provider-coder"
44
subcategory:""
55
description:|-
6-
Use this data source to configure editable options for workspaces.
6+
Use this data source to configure editable options for workspaces.
77
---
88

99
#coder_parameter (Data Source)
@@ -16,119 +16,119 @@ Use this data source to configure editable options for workspaces.
1616
provider "coder" {}
1717
1818
data "coder_parameter" "example" {
19-
name = "Region"
20-
description = "Specify a region to place your workspace."
21-
mutable = false
22-
type = "string"
23-
default = "us-central1-a"
24-
option {
25-
value = "us-central1-a"
26-
name = "US Central"
27-
icon = "/icons/1f1fa-1f1f8.png"
28-
}
29-
option {
30-
value = "asia-southeast1-a"
31-
name = "Singapore"
32-
icon = "/icons/1f1f8-1f1ec.png"
33-
}
19+
name = "Region"
20+
description = "Specify a region to place your workspace."
21+
mutable = false
22+
type = "string"
23+
default = "us-central1-a"
24+
option {
25+
value = "us-central1-a"
26+
name = "US Central"
27+
icon = "/icons/1f1fa-1f1f8.png"
28+
}
29+
option {
30+
value = "asia-southeast1-a"
31+
name = "Singapore"
32+
icon = "/icons/1f1f8-1f1ec.png"
33+
}
3434
}
3535
3636
data "coder_parameter" "ami" {
37-
name = "Machine Image"
38-
description = <<-EOT
39-
# Provide the machine image
40-
See the [registry](https://container.registry.blah/namespace) for options.
41-
EOT
42-
option {
43-
value = "ami-xxxxxxxx"
44-
name = "Ubuntu"
45-
icon = "/icon/ubuntu.svg"
46-
}
37+
name = "Machine Image"
38+
description = <<-EOT
39+
# Provide the machine image
40+
See the [registry](https://container.registry.blah/namespace) for options.
41+
EOT
42+
option {
43+
value = "ami-xxxxxxxx"
44+
name = "Ubuntu"
45+
icon = "/icon/ubuntu.svg"
46+
}
4747
}
4848
4949
data "coder_parameter" "is_public_instance" {
50-
name = "Is public instance?"
51-
type = "bool"
52-
icon = "/icon/docker.svg"
53-
default = false
50+
name = "Is public instance?"
51+
type = "bool"
52+
icon = "/icon/docker.svg"
53+
default = false
5454
}
5555
5656
data "coder_parameter" "cores" {
57-
name = "CPU Cores"
58-
type = "number"
59-
icon = "/icon/cpu.svg"
60-
default = 3
61-
order = 10
57+
name = "CPU Cores"
58+
type = "number"
59+
icon = "/icon/cpu.svg"
60+
default = 3
61+
order = 10
6262
}
6363
6464
data "coder_parameter" "disk_size" {
65-
name = "Disk Size"
66-
type = "number"
67-
default = "5"
68-
order = 8
69-
validation {
70-
# This can apply to number.
71-
min = 0
72-
max = 10
73-
monotonic = "increasing"
74-
}
65+
name = "Disk Size"
66+
type = "number"
67+
default = "5"
68+
order = 8
69+
validation {
70+
# This can apply to number.
71+
min = 0
72+
max = 10
73+
monotonic = "increasing"
74+
}
7575
}
7676
7777
data "coder_parameter" "cat_lives" {
78-
name = "Cat Lives"
79-
type = "number"
80-
default = "9"
81-
validation {
82-
# This can apply to number.
83-
min = 0
84-
max = 10
85-
monotonic = "decreasing"
86-
}
78+
name = "Cat Lives"
79+
type = "number"
80+
default = "9"
81+
validation {
82+
# This can apply to number.
83+
min = 0
84+
max = 10
85+
monotonic = "decreasing"
86+
}
8787
}
8888
8989
data "coder_parameter" "fairy_tale" {
90-
name = "Fairy Tale"
91-
type = "string"
92-
mutable = true
93-
default = "Hansel and Gretel"
94-
ephemeral = true
90+
name = "Fairy Tale"
91+
type = "string"
92+
mutable = true
93+
default = "Hansel and Gretel"
94+
ephemeral = true
9595
}
9696
9797
data "coder_parameter" "users" {
98-
name = "system_users"
99-
display_name = "System users"
100-
type = "list(string)"
101-
default = jsonencode(["root", "user1", "user2"])
98+
name = "system_users"
99+
display_name = "System users"
100+
type = "list(string)"
101+
default = jsonencode(["root", "user1", "user2"])
102102
}
103103
104104
data "coder_parameter" "home_volume_size" {
105-
name = "Home Volume Size"
106-
description = <<-EOF
107-
How large should your home volume be?
108-
EOF
109-
type = "number"
110-
default = 30
111-
mutable = true
112-
order = 3
113-
114-
option {
115-
name = "30GB"
116-
value = 30
117-
}
118-
119-
option {
120-
name = "60GB"
121-
value = 60
122-
}
123-
124-
option {
125-
name = "100GB"
126-
value = 100
127-
}
128-
129-
validation {
130-
monotonic = "increasing"
131-
}
105+
name = "Home Volume Size"
106+
description = <<-EOF
107+
How large should your home volume be?
108+
EOF
109+
type = "number"
110+
default = 30
111+
mutable = true
112+
order = 3
113+
114+
option {
115+
name = "30GB"
116+
value = 30
117+
}
118+
119+
option {
120+
name = "60GB"
121+
value = 60
122+
}
123+
124+
option {
125+
name = "100GB"
126+
value = 100
127+
}
128+
129+
validation {
130+
monotonic = "increasing"
131+
}
132132
}
133133
```
134134

‎docs/data-sources/provisioner.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
page_title:"coder_provisioner Data Source - terraform-provider-coder"
44
subcategory:""
55
description:|-
6-
Use this data source to get information about the Coder provisioner.
6+
Use this data source to get information about the Coder provisioner.
77
---
88

99
#coder_provisioner (Data Source)
@@ -20,15 +20,15 @@ data "coder_provisioner" "dev" {}
2020
data "coder_workspace" "dev" {}
2121
2222
resource "coder_agent" "main" {
23-
arch = data.coder_provisioner.dev.arch
24-
os = data.coder_provisioner.dev.os
25-
dir = "/workspace"
26-
display_apps {
27-
vscode = true
28-
vscode_insiders = false
29-
web_terminal = true
30-
ssh_helper = false
31-
}
23+
arch = data.coder_provisioner.dev.arch
24+
os = data.coder_provisioner.dev.os
25+
dir = "/workspace"
26+
display_apps {
27+
vscode = true
28+
vscode_insiders = false
29+
web_terminal = true
30+
ssh_helper = false
31+
}
3232
}
3333
```
3434

‎docs/data-sources/workspace.md‎

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
page_title:"coder_workspace Data Source - terraform-provider-coder"
44
subcategory:""
55
description:|-
6-
Use this data source to get information for the active workspace build.
6+
Use this data source to get information for the active workspace build.
77
---
88

99
#coder_workspace (Data Source)
@@ -22,42 +22,42 @@ data "coder_workspace" "me" {}
2222
data "coder_workspace_owner" "me" {}
2323
2424
resource "coder_agent" "dev" {
25-
arch = "amd64"
26-
os = "linux"
27-
dir = "/workspace"
25+
arch = "amd64"
26+
os = "linux"
27+
dir = "/workspace"
2828
}
2929
3030
resource "docker_container" "workspace" {
31-
count = data.coder_workspace.me.start_count
32-
image = docker_image.main.name
33-
# Uses lower() to avoid Docker restriction on container names.
34-
name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
35-
# Hostname makes the shell more user friendly: coder@my-workspace:~$
36-
hostname = data.coder_workspace.me.name
37-
# Use the docker gateway if the access URL is 127.0.0.1
38-
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
39-
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
40-
host {
41-
host = "host.docker.internal"
42-
ip = "host-gateway"
43-
}
44-
# Add labels in Docker to keep track of orphan resources.
45-
labels {
46-
label = "coder.owner"
47-
value = data.coder_workspace_owner.me.name
48-
}
49-
labels {
50-
label = "coder.owner_id"
51-
value = data.coder_workspace_owner.me.id
52-
}
53-
labels {
54-
label = "coder.workspace_id"
55-
value = data.coder_workspace.me.id
56-
}
57-
labels {
58-
label = "coder.workspace_name"
59-
value = data.coder_workspace.me.name
60-
}
31+
count = data.coder_workspace.me.start_count
32+
image = docker_image.main.name
33+
# Uses lower() to avoid Docker restriction on container names.
34+
name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
35+
# Hostname makes the shell more user friendly: coder@my-workspace:~$
36+
hostname = data.coder_workspace.me.name
37+
# Use the docker gateway if the access URL is 127.0.0.1
38+
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
39+
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
40+
host {
41+
host = "host.docker.internal"
42+
ip = "host-gateway"
43+
}
44+
# Add labels in Docker to keep track of orphan resources.
45+
labels {
46+
label = "coder.owner"
47+
value = data.coder_workspace_owner.me.name
48+
}
49+
labels {
50+
label = "coder.owner_id"
51+
value = data.coder_workspace_owner.me.id
52+
}
53+
labels {
54+
label = "coder.workspace_id"
55+
value = data.coder_workspace.me.id
56+
}
57+
labels {
58+
label = "coder.workspace_name"
59+
value = data.coder_workspace.me.name
60+
}
6161
}
6262
```
6363

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp