Skip to content
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

AUT-2321: Adding support for custom lists #27

Merged
merged 9 commits into from
Oct 16, 2024
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
28 changes: 28 additions & 0 deletions docs/data-sources/value_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "authsignal_value_list Data Source - terraform-provider-authsignal"
subcategory: ""
description: |-

---

# authsignal_value_list (Data Source)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `alias` (String) The hypenated name of the list.

### Read-Only

- `is_active` (Boolean) Whether or not the list is active. This currently has no effect.
- `item_type` (String) The type of the items in the list. Allowed values: `string`, `number`.
- `name` (String) The name of the list.
- `value_list_items_numbers` (List of Number) The list of items.
- `value_list_items_strings` (List of String) The list of items.
8 changes: 4 additions & 4 deletions docs/resources/action_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ resource "authsignal_action_configuration" "terraform-provider-test" {
### Required

- `action_code` (String) The name of the action that users perform which you will track. (e.g 'login')
- `default_user_action_result` (String) The default action behavior if no rules match. (i.e 'CHALLENGE').
- `default_user_action_result` (String) The default action behavior if no rules match. Allowed values: `ALLOW`, `CHALLENGE`, `REVIEW`, `BLOCK`.

### Optional

- `default_verification_method` (String) Ignore the user's preference and choose which authenticator the Pre-built UI will present by default.
- `default_verification_method` (String) Ignore the user's preference and choose which authenticator the Pre-built UI will present by default. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.
- `messaging_templates` (String) Optional messaging templates to be shown in Authsignal's pre-built UI.
- `prompt_to_enroll_verification_methods` (List of String) If this is set then users will be prompted to add a passkey after a challenge is completed.
- `verification_methods` (List of String) A list of permitted authenticators that can be used if the result of the action is 'CHALLENGE'.
- `prompt_to_enroll_verification_methods` (List of String) If this is set then users will be prompted to add a passkey after a challenge is completed. Allowed values: `[PASSKEY]`.
- `verification_methods` (List of String) A list of permitted authenticators that can be used if the result of the action is 'CHALLENGE'. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.

### Read-Only

Expand Down
8 changes: 4 additions & 4 deletions docs/resources/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ resource "authsignal_rule" "test" {
- `is_active` (Boolean) Toggles whether or not the rule is actively applied.
- `name` (String) A string used to name the rule.
- `priority` (Number) Determines the order which the rules are applied in, where 0 is applied first, 1 is applied second...
- `type` (String) The result that the rule should return when the conditions are met. (e.g. ALLOW, CHALLENGE)
- `type` (String) The result that the rule should return when the conditions are met. Allowed values: `ALLOW`, `CHALLENGE`, `REVIEW`, `BLOCK`.

### Optional

- `default_verification_method` (String) Ignore the user's preference and choose which authenticator the Pre-built UI will present by default.
- `default_verification_method` (String) Ignore the user's preference and choose which authenticator the Pre-built UI will present by default. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.
- `description` (String) A description of the rule.
- `prompt_to_enroll_verification_methods` (List of String) If this is set then users will be prompted to add a passkey after a challenge is completed.
- `verification_methods` (List of String) A list of permitted authenticators that can be used if the type of the rule is 'CHALLENGE'.
- `prompt_to_enroll_verification_methods` (List of String) If this is set then users will be prompted to add a passkey after a challenge is completed. Allowed values: `[PASSKEY]`.
- `verification_methods` (List of String) A list of permitted authenticators that can be used if the type of the rule is 'CHALLENGE'. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.

### Read-Only

Expand Down
16 changes: 8 additions & 8 deletions docs/resources/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ Optional:

Optional:

- `content_alignment` (String)
- `logo_alignment` (String)
- `content_alignment` (String) Allowed values: `left`, `center`.
- `logo_alignment` (String) Allowed values: `left`, `center`.
- `logo_height` (Number)
- `logo_position` (String)
- `logo_position` (String) Allowed values: `inside`, `outside`.
- `padding` (Number)
- `position` (String)
- `position` (String) Allowed values: `inside`, `outside`.


<a id="nestedatt--dark_mode"></a>
Expand Down Expand Up @@ -256,12 +256,12 @@ Optional:

Optional:

- `content_alignment` (String)
- `logo_alignment` (String)
- `content_alignment` (String) Allowed values: `left`, `center`.
- `logo_alignment` (String) Allowed values: `left`, `center`.
- `logo_height` (Number)
- `logo_position` (String)
- `logo_position` (String) Allowed values: `inside`, `outside`.
- `padding` (Number)
- `position` (String)
- `position` (String) Allowed values: `inside`, `outside`.


<a id="nestedatt--dark_mode--page_background"></a>
Expand Down
62 changes: 62 additions & 0 deletions docs/resources/value_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "authsignal_value_list Resource - terraform-provider-authsignal"
subcategory: ""
description: |-

---

# authsignal_value_list (Resource)



## Example Usage

```terraform
resource "authsignal_value_list" "example_value_list_strings" {
name = "Example Value List Strings"
is_active = true
value_list_items_strings = [
"hello",
"world",
"I am a string",
]
}

resource "authsignal_value_list" "example_value_list_numbers" {
name = "Example Value List Numbers"
is_active = true
value_list_items_numbers = [
1,
2,
3,
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `is_active` (Boolean) Whether or not the list is active. This currently has no effect, please set the value to `true`.
- `name` (String) The name of the value list.

### Optional

- `value_list_items_numbers` (List of Number) A list of number items in the value list.
- `value_list_items_strings` (List of String) A list of string items in the value list.

### Read-Only

- `alias` (String) The hyphenated alias of the value list, auto-generated upon creation.
- `item_type` (String) The type of items in the value list (string or number).

## Import

Import is supported using the following syntax:

```shell
# value lists can be imported with the following command. The value provided is the value list alias.
terraform import authsignal_value_list.example_value_list "example-value-list"
```
3 changes: 3 additions & 0 deletions examples/data-sources/authsignal_value_list/data_source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "authsignal_value_list" "example_value_list" {
alias = "example-value-list"
}
2 changes: 2 additions & 0 deletions examples/resources/authsignal_value_list/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# value lists can be imported with the following command. The value provided is the value list alias.
terraform import authsignal_value_list.example_value_list "example-value-list"
19 changes: 19 additions & 0 deletions examples/resources/authsignal_value_list/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "authsignal_value_list" "example_value_list_strings" {
name = "Example Value List Strings"
is_active = true
value_list_items_strings = [
"hello",
"world",
"I am a string",
]
}

resource "authsignal_value_list" "example_value_list_numbers" {
name = "Example Value List Numbers"
is_active = true
value_list_items_numbers = [
1,
2,
3,
]
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/authsignal/terraform-provider-authsignal
go 1.22.0

require (
github.com/authsignal/authsignal-management-go/v2 v2.3.0
github.com/authsignal/authsignal-management-go/v2 v2.4.0
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-framework v1.7.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/authsignal/authsignal-management-go/v2 v2.3.0 h1:blZvcBogpD1uRuANM86J5wAyjbztgpzRTZniB9abNZA=
github.com/authsignal/authsignal-management-go/v2 v2.3.0/go.mod h1:vRrL3bs794IPmy6BMbbmYCyf/QydU8Bg5cgZpCc4G9Q=
github.com/authsignal/authsignal-management-go/v2 v2.4.0 h1:mcjI4zKBEW7RwnLpzZBvT1t4Zh2MjJrw8FcBmuGXok4=
github.com/authsignal/authsignal-management-go/v2 v2.4.0/go.mod h1:vRrL3bs794IPmy6BMbbmYCyf/QydU8Bg5cgZpCc4G9Q=
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/action_configuration_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *actionConfigurationResource) Schema(_ context.Context, _ resource.Schem
},
},
"default_user_action_result": schema.StringAttribute{
Description: "The default action behavior if no rules match. (i.e 'CHALLENGE').",
Description: "The default action behavior if no rules match. Allowed values: `ALLOW`, `CHALLENGE`, `REVIEW`, `BLOCK`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf([]string{"ALLOW", "CHALLENGE", "REVIEW", "BLOCK"}...),
Expand All @@ -80,22 +80,22 @@ func (r *actionConfigurationResource) Schema(_ context.Context, _ resource.Schem
},
"verification_methods": schema.ListAttribute{
ElementType: types.StringType,
Description: "A list of permitted authenticators that can be used if the result of the action is 'CHALLENGE'.",
Description: "A list of permitted authenticators that can be used if the result of the action is 'CHALLENGE'. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.",
Optional: true,
Validators: []validator.List{
listvalidator.ValueStringsAre(stringvalidator.OneOf([]string{"SMS", "AUTHENTICATOR_APP", "EMAIL_MAGIC_LINK", "EMAIL_OTP", "PUSH", "SECURITY_KEY", "PASSKEY", "VERIFF", "IPROOV", "REDROCK", "IDVERSE"}...)),
},
},
"prompt_to_enroll_verification_methods": schema.ListAttribute{
ElementType: types.StringType,
Description: "If this is set then users will be prompted to add a passkey after a challenge is completed.",
Description: "If this is set then users will be prompted to add a passkey after a challenge is completed. Allowed values: `[PASSKEY]`.",
Optional: true,
Validators: []validator.List{
listvalidator.ValueStringsAre(stringvalidator.OneOf([]string{"PASSKEY"}...)),
},
},
"default_verification_method": schema.StringAttribute{
Description: "Ignore the user's preference and choose which authenticator the Pre-built UI will present by default.",
Description: "Ignore the user's preference and choose which authenticator the Pre-built UI will present by default. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.",
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf([]string{"SMS", "AUTHENTICATOR_APP", "EMAIL_MAGIC_LINK", "EMAIL_OTP", "PUSH", "SECURITY_KEY", "PASSKEY", "VERIFF", "IPROOV", "REDROCK", "IDVERSE"}...),
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (p *authsignalProvider) DataSources(_ context.Context) []func() datasource.
NewActionConfigurationDataSource,
NewRuleDataSource,
NewThemeDataSource,
NewValueListDataSource,
}
}

Expand All @@ -174,5 +175,6 @@ func (p *authsignalProvider) Resources(_ context.Context) []func() resource.Reso
NewActionConfigurationResource,
NewRuleResource,
NewThemeResource,
NewValueListResource,
}
}
8 changes: 4 additions & 4 deletions internal/provider/rule_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,30 @@ func (d *ruleResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
},
},
"type": schema.StringAttribute{
Description: "The result that the rule should return when the conditions are met. (e.g. ALLOW, CHALLENGE)",
Description: "The result that the rule should return when the conditions are met. Allowed values: `ALLOW`, `CHALLENGE`, `REVIEW`, `BLOCK`.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOf([]string{"ALLOW", "CHALLENGE", "REVIEW", "BLOCK"}...),
},
},
"verification_methods": schema.ListAttribute{
ElementType: types.StringType,
Description: "A list of permitted authenticators that can be used if the type of the rule is 'CHALLENGE'.",
Description: "A list of permitted authenticators that can be used if the type of the rule is 'CHALLENGE'. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.",
Optional: true,
Validators: []validator.List{
listvalidator.ValueStringsAre(stringvalidator.OneOf([]string{"SMS", "AUTHENTICATOR_APP", "EMAIL_MAGIC_LINK", "EMAIL_OTP", "PUSH", "SECURITY_KEY", "PASSKEY", "VERIFF", "IPROOV", "REDROCK", "IDVERSE"}...)),
},
},
"prompt_to_enroll_verification_methods": schema.ListAttribute{
ElementType: types.StringType,
Description: "If this is set then users will be prompted to add a passkey after a challenge is completed.",
Description: "If this is set then users will be prompted to add a passkey after a challenge is completed. Allowed values: `[PASSKEY]`.",
Optional: true,
Validators: []validator.List{
listvalidator.ValueStringsAre(stringvalidator.OneOf([]string{"PASSKEY"}...)),
},
},
"default_verification_method": schema.StringAttribute{
Description: "Ignore the user's preference and choose which authenticator the Pre-built UI will present by default.",
Description: "Ignore the user's preference and choose which authenticator the Pre-built UI will present by default. Allowed values: `SMS`, `AUTHENTICATOR_APP`, `EMAIL_MAGIC_LINK`, `EMAIL_OTP`, `PUSH`, `SECURITY_KEY`, `PASSKEY`, `VERIFF`, `IPROOV`, `REDROCK`, `IDVERSE`.",
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf([]string{"SMS", "AUTHENTICATOR_APP", "EMAIL_MAGIC_LINK", "EMAIL_OTP", "PUSH", "SECURITY_KEY", "PASSKEY", "VERIFF", "IPROOV", "REDROCK", "IDVERSE"}...),
Expand Down
Loading