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

[Bug]: Terraform doesn't send ColumnIndex and RowIndex fields in API call when using value 0 in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid #33108

Closed
udidn opened this issue Aug 20, 2023 · 8 comments · Fixed by #33931
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/quicksight Issues and PRs that pertain to the quicksight service.
Milestone

Comments

@udidn
Copy link

udidn commented Aug 20, 2023

Terraform Core Version

1.5.3

AWS Provider Version

5.13.1

Affected Resource(s)

column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid

Expected Behavior

When specifying 0 as a value in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, Terraform should send these fields with 0 value in create or update operations

Actual Behavior

When specifying 0 as a value in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, Terraform doesn't send these fields in create or update operations, causing QuickSight to incorrectly render the element on the grid

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_quicksight_analysis" "test" {
  analysis_id = "test"
  name        = "test"
  theme_arn   = "arn:aws:quicksight::aws:theme/CLASSIC"

  definition {
    data_set_identifiers_declarations {
      identifier   = aws_quicksight_data_set.test.name
      data_set_arn = aws_quicksight_data_set.test.arn
    }

    sheets {
      sheet_id = "sheet-id1"
      description = "Some description"
      name = "Some Name"
      content_type = "INTERACTIVE"
      text_boxes {
        sheet_text_box_id = "textbox-id"
        content = "Some text here"
      }
      layouts {
        configuration {
          grid_layout {
            elements {
              column_index = 0
              column_span  = 36
              element_id   = "element-id1"
              element_type = "TEXT_BOX"
              row_index    = 0
              row_span     = 3
            }
          }
        }
      }
      parameter_controls {
        dropdown {
          parameter_control_id  = "control-id1"
          source_parameter_name = "TestParameter1"
          title                 = "Test Control 1"
          display_options {
            select_all_options {
              visibility = "VISIBLE"
            }
            title_options {
              visibility = "VISIBLE"
              font_configuration {
                font_size {
                  relative = "MEDIUM"
                }
              }
            }
          }
          type = "MULTI_SELECT"
          selectable_values {
            link_to_data_set_column {
              column_name         = "column1"
              data_set_identifier = aws_quicksight_data_set.test.name
            }
          }
        }
      }
      parameter_controls {
        dropdown {
          parameter_control_id  = "control-id2"
          source_parameter_name = "TestParameter2"
          title                 = "Test Control 2"
          display_options {
            select_all_options {
              visibility = "VISIBLE"
            }
            title_options {
              visibility = "VISIBLE"
              font_configuration {
                font_size {
                  relative = "MEDIUM"
                }
              }
            }
          }
          type = "MULTI_SELECT"
          selectable_values {
            link_to_data_set_column {
              column_name         = "column2"
              data_set_identifier = aws_quicksight_data_set.test.name
            }
          }
          cascading_control_configuration {
            source_controls {
              source_sheet_control_id = "control-id1"
              column_to_match {
                column_name         = "column1"
                data_set_identifier = aws_quicksight_data_set.test.name
              }
            }
          }
        }
      }
    }

    analysis_defaults {
      default_new_sheet_configuration {
        interactive_layout_configuration {
          grid {
            canvas_size_options {
              screen_canvas_size_options {
                resize_option             = "FIXED"
                optimized_view_port_width = "1600px"
              }
            }
          }
        }
        sheet_content_type = "INTERACTIVE"
      }
    }
  }
}

Steps to Reproduce

Run terraform apply either when creating the aws_quicksight_analysis resource from scratch or when updating it (after adding the relevant block)

Debug Output

After running terraform apply to create or update the aws_quicksight_analysis resource, you'll see the following logs (an example from an update operation):

2023-08-20T10:53:55.812+0300 [DEBUG] provider.terraform-provider-aws_v5.13.1_x5: HTTP Request Sent: http.url=https://quicksight.us-east-1.amazonaws.com/accounts/111111111111/analyses/test net.peer.name=quicksight.us-east-1.amazonaws.com tf_req_id=<id> aws.service=QuickSight http.request.header.content_type=application/json http.request.body=

After the http.request.body= there will be the body of the QuickSight UpdateAnalysis API call.
Here's the relevant snippet:

"Layouts":
[
    {
        "Configuration":
        {
            "GridLayout":
            {
                "Elements":
                [
                    {
                        "ColumnSpan": 36,
                        "ElementId": "element-id1",
                        "ElementType": "TEXT_BOX",
                        "RowSpan": 3
                    }
                ]
            }
        }
    }
]

As you can see, the ColumnIndex and RowIndex fields aren't present in the Element block.
They should be present, with 0 value, since this is what was specified in the Terraform configuration

Panic Output

No response

Important Factoids

I saw this issue only in the ColumnIndex and RowIndex fields, but I suppose it'll be recreated also in the ColumnSpan and RawSpan fields (but I didn't try)

References

To prove that including the ColumnIndex and RowIndex fields with 0 value solves the issue, I executed the UpdateAnalysis API call using AWS CLI, providing these fields with 0 value.
I then refreshed the QuickSIght Analysis in my browser, and I saw the elements are rendered properly, as expected, in the grid

Would you like to implement a fix?

None

@udidn udidn added the bug Addresses a defect in current functionality. label Aug 20, 2023
@github-actions github-actions bot added the service/quicksight Issues and PRs that pertain to the quicksight service. label Aug 20, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@udidn udidn changed the title [Bug]: Terraform doesn't send a field in API call when using value 0 in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid [Bug]: Terraform doesn't send fields in API call when using value 0 in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid Aug 20, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 20, 2023
@udidn udidn changed the title [Bug]: Terraform doesn't send fields in API call when using value 0 in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid [Bug]: Terraform doesn't send ColumnIndex and RowIndex fields in API call when using value 0 in column_index and row_index fields in definition.sheets.layouts.configuration.grid_layout.format_text.elements block in aws_quicksight_analysis resource, causing QuickSight to incorrectly render the element on the grid Aug 20, 2023
@justinretzolk justinretzolk added prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 21, 2023
@udidn
Copy link
Author

udidn commented Sep 19, 2023

Is there any update on this issue?
It's preventing users from creating a normal QuickSight analysis as the element is incorrectly rendered on the grid

@atlesp
Copy link

atlesp commented Sep 19, 2023

I can confirm this behavior. The rowindex I can workaround just starting everything on 1 instead of zero , but it is harder with columnindex since that will take valuable space, while for rowindex it seems Quicksight to just removes the none used space on the top

@udidn
Copy link
Author

udidn commented Sep 19, 2023

I couldn't work-around the issue because when setting RowIndex to 1 (or ColumnIndex, I don't remember), I got an error.
However, I found another workaround. My original layout config is below:

layouts {
  configuration {
    grid_layout {
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_visual_kpi_unmounted_pvs_cost_uuid.id
        element_type = "VISUAL"
        column_index = 30
        column_span  = 6
        row_index    = 3
        row_span     = 3
      }
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_text_box_general_spend_and_trends_summary_uuid.id
        element_type = "TEXT_BOX"
        column_index = 0
        column_span  = 36
        row_index    = 0
        row_span     = 3
      }
    }
  }
}

The result of this config should be:

  1. The text-box should be on the top of the grid, spanning all the way from left to right
  2. The visual should be below the text-box, on the right-most side of the grid, spanning 3 rows

I confirm this is working as expected when using AWS CLI (the 0 values are sent).
With Terraform, the 0 values aren't sent, and the end result is:

  1. The visual is on top, right-most side of the grid, spanning 3 rows
  2. The text-box is below it, spanning all the way from left to right

The workaround I found is:

  1. Swap the order in the Terraform config file, so that the text-box element will be first and the visual element second
  2. Change the row_index of the visual to 0 (which means that Terraform won't sent it)

Config below:

layouts {
  configuration {
    grid_layout {
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_text_box_general_spend_and_trends_summary_uuid.id
        element_type = "TEXT_BOX"
        column_index = 0
        column_span  = 36
        row_index    = 0
        row_span     = 3
      }
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_visual_kpi_unmounted_pvs_cost_uuid.id
        element_type = "VISUAL"
        column_index = 30
        column_span  = 6
        row_index    = 0
        row_span     = 3
      }
    }
  }
}

The result is:

  1. The text-box is on the top of the grid, spanning all the way from left to right
  2. The visual is below the text-box, on the left-most side of the grid, spanning 3 rows

I confirm it behaves the same when I use AWS CLI and in the JSON, I remove the fields that were 0 in Terraform.
The only problem with this workaround is that the visual, for some reason, is placed in the left-most side.
This is although the column_index is 30, which should place it on the right-most side.
It looks like when not including the row_index, QuickSight just throws the visual to the left-most part for some reason.
The problem here is when I add another visual with column_index of 24, it's placed to the right of the previous visual.
I'd expect it would be placed to the left of the visual that has column_index of 30, and then eventually as I add visuals that fill the row completely, they'll be ordered as expected.
But this is not the case, and to get to the correct ordering as I intend (when not sending row_index), I need to reverse the column_index numbers of my visuals, which makes this workaround quite complex.

If anyone is aware of another workaround, I'd be happy to hear

@udidn
Copy link
Author

udidn commented Sep 19, 2023

Can someone please prioritize this issue?
It should be fixed so that when 0 is used in one of those fields, it is sent in the API call body.
Without this, the visuals in the grid are shifted, and working-around this issue becomes quite complex

@udidn
Copy link
Author

udidn commented Sep 19, 2023

@atlesp, your workaround works (starting from 1), I just misunderstood initially.
Here's my working configuration (for reference in case someone else will need it):

layouts {
  configuration {
    grid_layout {
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_text_box_general_spend_and_trends_summary_uuid.id
        element_type = "TEXT_BOX"
        column_index = 1
        column_span  = 35
        row_index    = 1
        row_span     = 3
      }
      elements {
        element_id   = random_uuid.qs_analysis_eks_insights_sheet_executive_summary_visual_kpi_unmounted_pvs_cost_uuid.id
        element_type = "VISUAL"
        column_index = 30
        column_span  = 6
        row_index    = 4
        row_span     = 3
      }
    }
  }
}

I see what you mean with the column_index issue, there's a small part of the canvas left without any visual in it.
I think I can work with this as a workaround. Thank you for the help!

Still, can someone please prioritize this issue?

@github-actions github-actions bot added this to the v5.26.0 milestone Nov 14, 2023
@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Nov 16, 2023
Copy link

This functionality has been released in v5.26.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/quicksight Issues and PRs that pertain to the quicksight service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants