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]: aws_quicksight_folder - trigger force recreation by inconsistent parent_folder_arn property #31922

Closed
posquit0 opened this issue Jun 13, 2023 · 6 comments · Fixed by #32592
Labels
bug Addresses a defect in current functionality. service/quicksight Issues and PRs that pertain to the quicksight service.
Milestone

Comments

@posquit0
Copy link
Contributor

Terraform Core Version

1.3.1

AWS Provider Version

4.67.0

Affected Resource(s)

  • aws_quicksight_folder

Expected Behavior

No change

Actual Behavior

Suggest force recreation for aws_quicksight_folder resources which deeper than 2 depth.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_quicksight_folder" "primary" {
  folder_id         = "folder-1"
  name              = "folder-1"
  folder_type       = "SHARED"
  parent_folder_arn = null
}

resource "aws_quicksight_folder" "secondary" {
  folder_id         = "folder-2"
  name              = "folder-2"
  folder_type       = "SHARED"
  parent_folder_arn = aws_quicksight_folder.primary.arn
}

resource "aws_quicksight_folder" "tertiary" {
  folder_id         = "folder-3"
  name              = "folder-3"
  folder_type       = "SHARED"
  parent_folder_arn = aws_quicksight_folder.secondary.arn
}

Steps to Reproduce

Create QuickSight Folder with deep hierarchy.

folder-1
|
|-- folder-2
  |
  |-- folder-3

folder-3 produce force recreation by inconsistent parent_folder_arn property

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

  # module.folder__tertiary["part-sre"].aws_quicksight_folder.this must be replaced
-/+ resource "aws_quicksight_folder" "this" {
      ~ arn               = "arn:aws:quicksight:ap-northeast-2:xxxxxxxxxxxx:folder/part-sre" -> (known after apply)
      ~ aws_account_id    = "xxxxxxxxxxxx" -> (known after apply)
      ~ created_time      = "2023-06-13T06:57:26Z" -> (known after apply)
      ~ folder_path       = [
          - "arn:aws:quicksight:ap-northeast-2:xxxxxxxxxxxx:folder/company",
          - "arn:aws:quicksight:ap-northeast-2:xxxxxxxxxxxx:folder/team-infra",
        ] -> (known after apply)
      ~ id                = "xxxxxxxxxxxx,part-sre" -> (known after apply)
      ~ last_updated_time = "2023-06-13T06:57:26Z" -> (known after apply)
        name              = "xxxxxxxxxxxx"
      ~ parent_folder_arn = "arn:aws:quicksight:ap-northeast-2:xxxxxxxxxxxx:folder/company" -> "arn:aws:quicksight:ap-northeast-2:xxxxxxxxxxxx:folder/team-infra" # forces replacement
        tags              = {
            ...
        }
        # (3 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Would you like to implement a fix?

None

@posquit0 posquit0 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jun 13, 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.

@github-actions github-actions bot added the service/quicksight Issues and PRs that pertain to the quicksight service. label Jun 13, 2023
@justinretzolk
Copy link
Member

Hey @posquit0 👋 Thanks for taking the time to raise this! So that we have the necessary information to look into this, are you able to supply debug logs (redacted as needed) as well? It may not be strictly necessary in this case, but it may wind up being helpful.

Can you also detail any additional changes that are being made in the scenario when this happens? Based on the logs provided, is it safe to assume something is changing with aws_quicksight_folder.secondary in this case, or are no changes being made? I notice from the sample output that the parent_folder_arn in the state ends in folder/company and is being changed to folder/team-infra; does it seem as the the value is being mis-set?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 13, 2023
@posquit0
Copy link
Contributor Author

@justinretzolk There are no changes to aws_quicksight_folder.secondary resource. If you run the terraform apply command twice continuously, you can immediately check the force recreation plan.

When I check the API documentation, there is output data for the folder path, not the parent folder value. I'm suspecting that the implementation in terraform-provider-aws is miscalculating the parent folder through the folder path.

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Jun 14, 2023
@miguelhentoux
Copy link

@posquit0 @justinretzolk I had the same issue.

When creating the third-level folder, terraform always tries to recreate it.

Code:

resource "aws_quicksight_folder" "folder-1" {
    folder_id = "folder-1"
    name      = "folder-1"
    aws_account_id = local.aws_account_id
    permissions {
      actions = local.quicksight_folder_admin_actions
      principal = local.admin_role
    }
}


resource "aws_quicksight_folder" "folder-2" {
    folder_id = "folder-2"
    name      = "folder-2"
    aws_account_id = local.aws_account_id
    parent_folder_arn = aws_quicksight_folder.folder-1.arn
    permissions {
      actions = local.quicksight_folder_admin_actions
      principal = local.admin_role
    }
}

resource "aws_quicksight_folder" "folder-3" {
    folder_id = "folder-3"
    name      = "folder-3"
    aws_account_id = local.aws_account_id
    parent_folder_arn = aws_quicksight_folder.folder-2.arn
    permissions {
      actions = local.quicksight_folder_admin_actions
      principal = local.admin_role
    }
}

Then running apply twice:

module.this.aws_quicksight_folder.folder-3 must be replaced
-/+ resource "aws_quicksight_folder" "folder-3" {
      ~ arn               = "arn:aws:quicksight:eu-central-1:-:folder/folder-3" -> (known after apply)
      ~ created_time      = "2023-07-18T14:18:09Z" -> (known after apply)
      ~ folder_path       = [
          - "arn:aws:quicksight:eu-central-1:-:folder/folder-1",
          - "arn:aws:quicksight:eu-central-1:-:folder/folder-2",
        ] -> (known after apply)
      ~ id                = "-,folder-3" -> (known after apply)
      ~ last_updated_time = "2023-07-18T14:18:09Z" -> (known after apply)
        name              = "folder-3"
      ~ parent_folder_arn = "arn:aws:quicksight:eu-central-1:-:folder/folder-1" -> "arn:aws:quicksight:eu-central-1:-:folder/folder-2" # forces replacement
      - tags              = {} -> null
      ~ tags_all          = {} -> (known after apply)
        # (3 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

@github-actions
Copy link

This functionality has been released in v5.9.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!

@github-actions
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 Aug 20, 2023
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. service/quicksight Issues and PRs that pertain to the quicksight service.
Projects
None yet
3 participants