Skip to content

feat: add owner_oidc_access_token to coder_workspace data source #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Optional:
- `error` (String) An error message to display if the value doesn't match the provided regex.
- `max` (Number) The maximum of a number parameter.
- `min` (Number) The minimum of a number parameter.
- `monotonic` (String) Number monotonicity, either increasing or decreasing.
- `regex` (String) A regex for the input parameter to match against.


1 change: 1 addition & 0 deletions docs/data-sources/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "kubernetes_pod" "dev" {
- `owner` (String) Username of the workspace owner.
- `owner_email` (String) Email address of the workspace owner.
- `owner_id` (String) UUID of the workspace owner.
- `owner_oidc_access_token` (String) A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When implemented in the coder side, I think this should be disabled by default and enableable with a flag or at the very least the other way around.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should mention that in this description too.

- `start_count` (Number) A computed count based on "transition" state. If "start", count will equal 1.
- `transition` (String) Either "start" or "stop". Use this to start/stop resources with "count".

Expand Down
10 changes: 10 additions & 0 deletions provider/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func workspaceDataSource() *schema.Resource {
}
_ = rd.Set("owner_id", ownerID)

ownerOIDCAccessToken := os.Getenv("CODER_WORKSPACE_OWNER_OIDC_ACCESS_TOKEN")
_ = rd.Set("owner_oidc_access_token", ownerOIDCAccessToken)

name := os.Getenv("CODER_WORKSPACE_NAME")
if name == "" {
name = "default"
Expand Down Expand Up @@ -111,6 +114,13 @@ func workspaceDataSource() *schema.Resource {
Computed: true,
Description: "UUID of the workspace owner.",
},
"owner_oidc_access_token": {
Type: schema.TypeString,
Computed: true,
Description: "A valid OpenID Connect access token of the workspace owner. " +
"This is only available if the workspace owner authenticated with OpenID Connect. " +
"If a valid token cannot be obtained, this value will be an empty string.",
},
"id": {
Type: schema.TypeString,
Computed: true,
Expand Down