Skip to content

Commit

Permalink
Make auth0_branding_theme fields optional (#499)
Browse files Browse the repository at this point in the history
* Set defaults for all the branding theme attributes

* Update branding theme data source test

* Re-triggering the CI

---------

Co-authored-by: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com>
  • Loading branch information
nialdaly and sergiught authored Mar 3, 2023
1 parent ce35f44 commit 8668fd7
Show file tree
Hide file tree
Showing 7 changed files with 523 additions and 207 deletions.
141 changes: 79 additions & 62 deletions docs/resources/branding_theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ This resource allows you to manage branding themes for your Universal Login page
## Example Usage

```terraform
# An example of the auth0_branding_theme using defaults for all the attributes.
resource "auth0_branding_theme" "my_theme" {
borders {}
colors {}
fonts {
title {}
subtitle {}
links {}
input_labels {}
buttons_text {}
body_text {}
}
page_background {}
widget {}
}
# An example of a fully configured auth0_branding_theme.
resource "auth0_branding_theme" "my_theme" {
borders {
button_border_radius = 1
Expand Down Expand Up @@ -117,45 +134,42 @@ resource "auth0_branding_theme" "my_theme" {
<a id="nestedblock--borders"></a>
### Nested Schema for `borders`

Required:
Optional:

- `button_border_radius` (Number) Button border radius. Value needs to be between `1` and `10`.
- `button_border_weight` (Number) Button border weight. Value needs to be between `0` and `10`.
- `buttons_style` (String) Buttons style. Available options: `pill`, `rounded`, `sharp`.
- `input_border_radius` (Number) Input border radius. Value needs to be between `0` and `10`.
- `input_border_weight` (Number) Input border weight. Value needs to be between `0` and `3`.
- `inputs_style` (String) Inputs style. Available options: `pill`, `rounded`, `sharp`.
- `show_widget_shadow` (Boolean) Show widget shadow.
- `widget_border_weight` (Number) Widget border weight. Value needs to be between `0` and `10`.
- `widget_corner_radius` (Number) Widget corner radius. Value needs to be between `0` and `50`.
- `button_border_radius` (Number) Button border radius. Value needs to be between `1` and `10`. Defaults to `3.0`.
- `button_border_weight` (Number) Button border weight. Value needs to be between `0` and `10`. Defaults to `1.0`.
- `buttons_style` (String) Buttons style. Available options: `pill`, `rounded`, `sharp`. Defaults to `rounded`.
- `input_border_radius` (Number) Input border radius. Value needs to be between `0` and `10`. Defaults to `3.0`.
- `input_border_weight` (Number) Input border weight. Value needs to be between `0` and `3`. Defaults to `1.0`.
- `inputs_style` (String) Inputs style. Available options: `pill`, `rounded`, `sharp`. Defaults to `rounded`.
- `show_widget_shadow` (Boolean) Show widget shadow. Defaults to `true`.
- `widget_border_weight` (Number) Widget border weight. Value needs to be between `0` and `10`. Defaults to `0.0`.
- `widget_corner_radius` (Number) Widget corner radius. Value needs to be between `0` and `50`. Defaults to `5.0`.


<a id="nestedblock--colors"></a>
### Nested Schema for `colors`

Required:

- `body_text` (String) Body text.
- `error` (String) Error.
- `header` (String) Header.
- `icons` (String) Icons.
- `input_background` (String) Input background.
- `input_border` (String) Input border.
- `input_filled_text` (String) Input filled text.
- `input_labels_placeholders` (String) Input labels & placeholders.
- `links_focused_components` (String) Links & focused components.
- `primary_button` (String) Primary button.
- `primary_button_label` (String) Primary button label.
- `secondary_button_border` (String) Secondary button border.
- `secondary_button_label` (String) Secondary button label.
- `success` (String) Success.
- `widget_background` (String) Widget background.
- `widget_border` (String) Widget border.

Optional:

- `base_focus_color` (String) Base focus color.
- `base_hover_color` (String) Base hover color.
- `base_focus_color` (String) Base focus color. Defaults to `#635dff`.
- `base_hover_color` (String) Base hover color. Defaults to `#000000`.
- `body_text` (String) Body text. Defaults to `#1e212a`.
- `error` (String) Error. Defaults to `#d03c38`.
- `header` (String) Header. Defaults to `#1e212a`.
- `icons` (String) Icons. Defaults to `#65676e`.
- `input_background` (String) Input background. Defaults to `#ffffff`.
- `input_border` (String) Input border. Defaults to `#c9cace`.
- `input_filled_text` (String) Input filled text. Defaults to `#000000`.
- `input_labels_placeholders` (String) Input labels & placeholders. Defaults to `#65676e`.
- `links_focused_components` (String) Links & focused components. Defaults to `#635dff`.
- `primary_button` (String) Primary button. Defaults to `#635dff`.
- `primary_button_label` (String) Primary button label. Defaults to `#ffffff`.
- `secondary_button_border` (String) Secondary button border. Defaults to `#c9cace`.
- `secondary_button_label` (String) Secondary button label. Defaults to `#1e212a`.
- `success` (String) Success. Defaults to `#13a688`.
- `widget_background` (String) Widget background. Defaults to `#ffffff`.
- `widget_border` (String) Widget border. Defaults to `#c9cace`.


<a id="nestedblock--fonts"></a>
Expand All @@ -165,89 +179,92 @@ Required:

- `body_text` (Block List, Min: 1, Max: 1) Body text. (see [below for nested schema](#nestedblock--fonts--body_text))
- `buttons_text` (Block List, Min: 1, Max: 1) Buttons text. (see [below for nested schema](#nestedblock--fonts--buttons_text))
- `font_url` (String) Font URL.
- `input_labels` (Block List, Min: 1, Max: 1) Input labels. (see [below for nested schema](#nestedblock--fonts--input_labels))
- `links` (Block List, Min: 1, Max: 1) Links. (see [below for nested schema](#nestedblock--fonts--links))
- `links_style` (String) Links style.
- `reference_text_size` (Number) Reference text size. Value needs to be between `12` and `24`.
- `subtitle` (Block List, Min: 1, Max: 1) Subtitle. (see [below for nested schema](#nestedblock--fonts--subtitle))
- `title` (Block List, Min: 1, Max: 1) Title. (see [below for nested schema](#nestedblock--fonts--title))

Optional:

- `font_url` (String) Font URL. Defaults to an empty string.
- `links_style` (String) Links style. Defaults to `normal`.
- `reference_text_size` (Number) Reference text size. Value needs to be between `12` and `24`. Defaults to `16.0`.

<a id="nestedblock--fonts--body_text"></a>
### Nested Schema for `fonts.body_text`

Required:
Optional:

- `bold` (Boolean) Body text bold.
- `size` (Number) Body text size. Value needs to be between `0` and `150`.
- `bold` (Boolean) Body text bold. Defaults to `false`.
- `size` (Number) Body text size. Value needs to be between `0` and `150`. Defaults to `87.5`.


<a id="nestedblock--fonts--buttons_text"></a>
### Nested Schema for `fonts.buttons_text`

Required:
Optional:

- `bold` (Boolean) Buttons text bold.
- `size` (Number) Buttons text size. Value needs to be between `0` and `150`.
- `bold` (Boolean) Buttons text bold. Defaults to `false`.
- `size` (Number) Buttons text size. Value needs to be between `0` and `150`. Defaults to `100.0`.


<a id="nestedblock--fonts--input_labels"></a>
### Nested Schema for `fonts.input_labels`

Required:
Optional:

- `bold` (Boolean) Input labels bold.
- `size` (Number) Input labels size. Value needs to be between `0` and `150`.
- `bold` (Boolean) Input labels bold. Defaults to `false`.
- `size` (Number) Input labels size. Value needs to be between `0` and `150`. Defaults to `100.0`.


<a id="nestedblock--fonts--links"></a>
### Nested Schema for `fonts.links`

Required:
Optional:

- `bold` (Boolean) Links bold.
- `size` (Number) Links size. Value needs to be between `0` and `150`.
- `bold` (Boolean) Links bold. Defaults to `true`.
- `size` (Number) Links size. Value needs to be between `0` and `150`. Defaults to `87.5`.


<a id="nestedblock--fonts--subtitle"></a>
### Nested Schema for `fonts.subtitle`

Required:
Optional:

- `bold` (Boolean) Subtitle bold.
- `size` (Number) Subtitle size. Value needs to be between `0` and `150`.
- `bold` (Boolean) Subtitle bold. Defaults to `false`.
- `size` (Number) Subtitle size. Value needs to be between `0` and `150`. Defaults to `87.5`.


<a id="nestedblock--fonts--title"></a>
### Nested Schema for `fonts.title`

Required:
Optional:

- `bold` (Boolean) Title bold.
- `size` (Number) Title size. Value needs to be between `75` and `150`.
- `bold` (Boolean) Title bold. Defaults to `false`.
- `size` (Number) Title size. Value needs to be between `75` and `150`. Defaults to `150.0`.



<a id="nestedblock--page_background"></a>
### Nested Schema for `page_background`

Required:
Optional:

- `background_color` (String) Background color.
- `background_image_url` (String) Background image url.
- `page_layout` (String) Page layout. Available options: `center`, `left`, `right`.
- `background_color` (String) Background color. Defaults to `#000000`.
- `background_image_url` (String) Background image url. Defaults to an empty string.
- `page_layout` (String) Page layout. Available options: `center`, `left`, `right`. Defaults to `center`.


<a id="nestedblock--widget"></a>
### Nested Schema for `widget`

Required:
Optional:

- `header_text_alignment` (String) Header text alignment. Available options: `center`, `left`, `right`.
- `logo_height` (Number) Logo height. Value needs to be between `1` and `100`.
- `logo_position` (String) Logo position. Available options: `center`, `left`, `right`, `none`.
- `logo_url` (String) Logo url.
- `social_buttons_layout` (String) Social buttons layout. Available options: `bottom`, `top`.
- `header_text_alignment` (String) Header text alignment. Available options: `center`, `left`, `right`. Defaults to `center`.
- `logo_height` (Number) Logo height. Value needs to be between `1` and `100`. Defaults to `52.0`.
- `logo_position` (String) Logo position. Available options: `center`, `left`, `right`, `none`. Defaults to `center`.
- `logo_url` (String) Logo url. Defaults to an empty string.
- `social_buttons_layout` (String) Social buttons layout. Available options: `bottom`, `top`. Defaults to `bottom`.

## Import

Expand Down
17 changes: 17 additions & 0 deletions examples/resources/auth0_branding_theme/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# An example of the auth0_branding_theme using defaults for all the attributes.
resource "auth0_branding_theme" "my_theme" {
borders {}
colors {}
fonts {
title {}
subtitle {}
links {}
input_labels {}
buttons_text {}
body_text {}
}
page_background {}
widget {}
}

# An example of a fully configured auth0_branding_theme.
resource "auth0_branding_theme" "my_theme" {
borders {
button_border_radius = 1
Expand Down
4 changes: 4 additions & 0 deletions internal/auth0/branding/data_source_theme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ resource "auth0_branding_theme" "my_theme" {
}
colors {
base_focus_color = "#635dff"
base_hover_color = "#000000"
body_text = "#FF00CC"
error = "#FF00CC"
header = "#FF00CC"
Expand Down Expand Up @@ -114,6 +116,8 @@ func TestAccDataSourceBrandingTheme(t *testing.T) {
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "borders.0.widget_border_weight", "1.11"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "borders.0.widget_corner_radius", "3.57"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.#", "1"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.0.base_focus_color", "#635dff"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.0.base_hover_color", "#000000"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.0.body_text", "#FF00CC"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.0.error", "#FF00CC"),
resource.TestCheckResourceAttr("data.auth0_branding_theme.test", "colors.0.header", "#FF00CC"),
Expand Down
Loading

0 comments on commit 8668fd7

Please sign in to comment.