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

feat: addoptional property tocoder_external_auth#185

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 4 commits intomainfromoptional-external-auth
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
4 changes: 4 additions & 0 deletionsdocs/data-sources/external_auth.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,10 @@ Use this data source to require users to authenticate with an external service p

- `id` (String) The ID of a configured external auth provider set up in your Coder deployment.

### Optional

- `optional` (Boolean) Authenticating with the external auth provider is not required, and can be skipped by users when creating or updating workspaces

### Read-Only

- `access_token` (String) The access token returned by the external auth provider. This can be used to pre-authenticate command-line tools.
7 changes: 6 additions & 1 deletionprovider/externalauth.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,8 +32,13 @@ func externalAuthDataSource() *schema.Resource {
},
"access_token": {
Type: schema.TypeString,
Computed: true,
Description: "The access token returned by the external auth provider. This can be used to pre-authenticate command-line tools.",
Computed: true,
},
"optional": {
Type: schema.TypeBool,
Description: "Authenticating with the external auth provider is not required, and can be skipped by users when creating or updating workspaces",
Optional: true,
},
},
}
Expand Down
34 changes: 34 additions & 0 deletionsprovider/externalauth_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,40 @@ func TestExternalAuth(t *testing.T) {

attribs := resource.Primary.Attributes
require.Equal(t, "github", attribs["id"])
require.Equal(t, "", attribs["optional"])

return nil
},
}},
})
}

func TestOptionalExternalAuth(t *testing.T) {
t.Parallel()

resource.Test(t, resource.TestCase{
Providers: map[string]*schema.Provider{
"coder": provider.New(),
},
IsUnitTest: true,
Steps: []resource.TestStep{{
Config: `
provider "coder" {
}
data "coder_external_auth" "github" {
id = "github"
optional = true
}
`,
Check: func(state *terraform.State) error {
require.Len(t, state.Modules, 1)
require.Len(t, state.Modules[0].Resources, 1)
resource := state.Modules[0].Resources["data.coder_external_auth.github"]
require.NotNil(t, resource)

attribs := resource.Primary.Attributes
require.Equal(t, "github", attribs["id"])
require.Equal(t, "true", attribs["optional"])

return nil
},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp