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]: Resource tag state reads ignorant of inheritance #31909

Closed
dacreify opened this issue Jun 12, 2023 · 3 comments · Fixed by #32201
Closed

[Bug]: Resource tag state reads ignorant of inheritance #31909

dacreify opened this issue Jun 12, 2023 · 3 comments · Fixed by #32201
Assignees
Labels
bug Addresses a defect in current functionality. service/lakeformation Issues and PRs that pertain to the lakeformation service.
Milestone

Comments

@dacreify
Copy link

dacreify commented Jun 12, 2023

Terraform Core Version

1.3.7

AWS Provider Version

4.67.0

Affected Resource(s)

  • aws_lakeformation_resource_lf_tags

Expected Behavior

When tag values are applied at a table or column level, other tag values inherited from the database or table level should be ignored when reading back state.

For example, consider this scenario:

  • Table my_table exists in database my_database
  • The tag foo=bar is applied to my_database and thus inherited by my_table
  • A tag value bam=baz is also applied directly to my_table

The GetResourceLFTags API call to Lake Formation will have both foo=bar and bam=baz in the LFTagsOnTable structure for my_table. However only bam=baz is applied directly to the table and foo=bar should be ignored for purposes of determining the state of the aws_lakeformation_resource_lf_tags resource with the table {database_name = "my_database", name = "my_table"} block.

Actual Behavior

Terraform perceives state drift on every refresh because it sees the inherited tags and (correctly) identifies that they are not part of the corresponding table/column-level aws_lakeformation_resource_lf_tags resource. All tags of tables and columns with inherited tag values are destroyed and recreated by each plan.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_glue_catalog_database" "database" {
  name = "my_database"
}

resource "aws_glue_catalog_table" "table" {
  database_name = "my_database"
  name          = "my_table"
}

resource "aws_lakeformation_resource_lf_tags" "database_tags" {
  database {
    name = "my_database"
  }

  lf_tag" {
    key   = "foo"
    value = "bar"
  }
}

resource "aws_lakeformation_resource_lf_tags" "table_tags" {
  table {
    database_name = "my_database"
    name          = "my_table"
  }

  lf_tag {
    key   = "bam"
    value = "baz"
  }
}

Steps to Reproduce

Apply and plan again to see phantom state drift

Debug Output

No response

Panic Output

No response

Important Factoids

The response from the GetResourceLFTags Lake Formation API call includes the full inheritance hierarchy for a given table/column via LFTagOnDatabase, LFTagsOnTable, and LFTagsOnColumns. By reducing over these it should be possible to resolve which tag values are being applied at the table/column level and thus resolve accurate state.

References

No response

Would you like to implement a fix?

None

@dacreify dacreify added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jun 12, 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 service/glue Issues and PRs that pertain to the glue service. service/lakeformation Issues and PRs that pertain to the lakeformation service. labels Jun 12, 2023
@justinretzolk justinretzolk removed service/glue Issues and PRs that pertain to the glue service. needs-triage Waiting for first response or review from a maintainer. labels Jun 12, 2023
@gdavison gdavison self-assigned this Jun 22, 2023
@github-actions github-actions bot added this to the v5.6.0 milestone Jun 26, 2023
@github-actions
Copy link

This functionality has been released in v5.6.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 Jul 30, 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/lakeformation Issues and PRs that pertain to the lakeformation service.
Projects
None yet
3 participants