terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

[Bug]: aws_lakeformation_resource_lf_tags should support multiple LF tag values per LF tag key

Open deanmatter opened this issue 2 years ago • 1 comments

Terraform Core Version

1.2.1

AWS Provider Version

4.40.0

Affected Resource(s)

aws_lakeformation_resource_lf_tags

Expected Behavior

I need to tag a Glue Database with multiple LF tag values for a single LF tag key. In the AWS LakeFormation Boto3 documentation, it's possible to provide a list of TagValues for a corresponding TagKey, with the add_lf_tags_to_resource function.

As a result, I was hoping to provide the aws_lakeformation_resource_lf_tags resource with a list of LF tag values as an argument, like the following:

resource "aws_lakeformation_resource_lf_tags" "example" {
  database {
    name = aws_glue_catalog_database.example.name
  }

  lf_tag {
    key   = aws_lakeformation_lf_tag.example.key
    value = ["stowe", "abbey"]    # note the list of strings here
  }
}

Actual Behavior

The value parameter in the lf_tag block of the aws_lakeformation_resource_lf_tags only supports string data type, so I am unable to provide a list of LF tag values. As a result, I am only able to add a single LF tag value per LF tag key attached to a database.

Relevant Error/Panic Output Snippet

Error: Incorrect attribute value type
on main.tf line 13, in resource "aws_lakeformation_resource_lf_tags" "example":
    value = ["stowe", "abbey"]
Inappropriate value for attribute "value": string required.

Terraform Configuration Files

resource "aws_lakeformation_lf_tag" "example" {
  key    = "right"
  values = ["abbey", "village", "luffield", "woodcote", "copse", "chapel", "stowe", "club"]
}

resource "aws_lakeformation_resource_lf_tags" "example" {
  database {
    name = aws_glue_catalog_database.example.name
  }

  lf_tag {
    key   = aws_lakeformation_lf_tag.example.key
    value = ["stowe", "abbey"]    # note the list of strings here
  }
}

Steps to Reproduce

Attempt to run a terraform plan with the above resource configuration and the error will be evident.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lakeformation.html#LakeFormation.Client.add_lf_tags_to_resource

Would you like to implement a fix?

No response

deanmatter avatar Nov 30 '22 13:11 deanmatter

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[bot] avatar Nov 30 '22 13:11 github-actions[bot]

I don't believe it's possible to apply more than one value for the same tag to a resource. e.g. If you attempt this in the console UI it won't let you. I believe the reason for seeing a list as the value of TagValues is due to the API reusing a type that appears in other contexts where multiple values is valid. e.g. When specifying what values a tag can take.

dacreify avatar Jun 12 '23 16:06 dacreify

Thanks for submitting this, @deanmatter. Unfortunately, the API doesn't actually support multiple values. It fails with

InvalidInputException: Tag value wild card was found or input tag value list has size not equal to 1

gdavison avatar Jun 22 '23 19:06 gdavison

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[bot] avatar Jul 23 '23 02:07 github-actions[bot]