Skip to content

Commit

Permalink
r/aws_quicksight_template: table header style font_configuration sche…
Browse files Browse the repository at this point in the history
…ma adjustments (#33018)

* r/aws_quicksight_template: table header style font_configuration schema adjustments

* chore: changelog
  • Loading branch information
jar-b authored Aug 16, 2023
1 parent 4175420 commit 5ec7e1b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .changelog/33018.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:bug
resource/aws_quicksight_analysis: Enable `font_configuration` to be set for table header styles
```

```release-note:bug
resource/aws_quicksight_analysis: Enable `font_configuration` to be set for table header styles
```

```release-note:bug
resource/aws_quicksight_analysis: Enable `font_configuration` to be set for table header styles
```
4 changes: 2 additions & 2 deletions internal/service/quicksight/schema/template_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ func flattenFontConfiguration(apiObject *quicksight.FontConfiguration) []interfa
}

func flattenFontSize(apiObject *quicksight.FontSize) []interface{} {
if apiObject == nil {
if apiObject == nil || apiObject.Relative == nil {
return nil
}

Expand All @@ -1222,7 +1222,7 @@ func flattenFontSize(apiObject *quicksight.FontSize) []interface{} {
}

func flattenFontWeight(apiObject *quicksight.FontWeight) []interface{} {
if apiObject == nil {
if apiObject == nil || apiObject.Name == nil {
return nil
}

Expand Down
8 changes: 3 additions & 5 deletions internal/service/quicksight/schema/template_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ func fontConfigurationSchema() *schema.Schema {
"font_decoration": stringSchema(false, validation.StringInSlice(quicksight.FontDecoration_Values(), false)),
"font_size": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_FontSize.html
Type: schema.TypeList,
MinItems: 1,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Expand All @@ -244,7 +243,6 @@ func fontConfigurationSchema() *schema.Schema {
"font_style": stringSchema(false, validation.StringInSlice(quicksight.FontStyle_Values(), false)),
"font_weight": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_FontWeight.html
Type: schema.TypeList,
MinItems: 1,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -562,13 +560,13 @@ func expandFontConfiguration(tfList []interface{}) *quicksight.FontConfiguration

config := &quicksight.FontConfiguration{}

if v, ok := tfMap["font_color"].(string); ok {
if v, ok := tfMap["font_color"].(string); ok && v != "" {
config.FontColor = aws.String(v)
}
if v, ok := tfMap["font_decoration"].(string); ok {
if v, ok := tfMap["font_decoration"].(string); ok && v != "" {
config.FontDecoration = aws.String(v)
}
if v, ok := tfMap["font_style"].(string); ok {
if v, ok := tfMap["font_style"].(string); ok && v != "" {
config.FontStyle = aws.String(v)
}
if v, ok := tfMap["font_size"].([]interface{}); ok && len(v) > 0 {
Expand Down
6 changes: 6 additions & 0 deletions internal/service/quicksight/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,12 @@ resource "aws_quicksight_template" "test" {
header_style {
background_color = "#99CCFF"
height = 20
font_configuration {
font_color = "#212121"
font_size {
relative = "LARGE"
}
}
}
}
sort_configuration {
Expand Down

0 comments on commit 5ec7e1b

Please sign in to comment.