TableWildcard is supported by SDK: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lakeformation.html#LakeFormation.Client.grant_permissions
but is not available in CloudFormation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-tableresource.html#cfn-lakeformation-permissions-tableresource-name
Currently we are using CF custom resources to support this which is not ideal
It seems that documentation is outdated, since I've added TableWildcard: {}in CF template and it works
I can confirm, I was also able to provision access to all tables. I've submitted a request to have the documentation updated, thanks @kherkeladze!
Hi @kherkeladze or @colonmelvin. When I have TableWildcard: {} in my CF, it does not work though. I have got this error:
Resource does not exist or requester is not authorized to access requested permissions. (Service: AWSLakeFormation; Status Code: 400; Error Code: AccessDeniedException
Do you mind posting an example of what was done?
Hi @mt-rpranata, be sure you have grant permissions to the Glue database or Lake Formation administrator permissions. We used the follow CFT as a Terraform resource:
{
聽聽聽聽"AWSTemplateFormatVersion":聽"2010-09-09",
聽聽聽聽"Resources":聽{
聽聽聽聽聽聽聽聽"databasepermissions":聽{
聽聽聽聽聽聽聽聽聽聽聽聽"Type":聽"AWS::LakeFormation::Permissions",
聽聽聽聽聽聽聽聽聽聽聽聽"Properties":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DataLakePrincipal":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DataLakePrincipalIdentifier"聽:聽"${aws_iam_role.service_role_glue.arn}"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽},
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"Permissions":聽[
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"ALL"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"PermissionsWithGrantOption":聽[
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"ALL"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"Resource":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DatabaseResource":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"Name":聽"${element(split(":",aws_glue_catalog_database.glue_database.id),1)}"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽},
聽聽聽聽聽聽聽聽聽聽聽聽"Metadata":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"AWS::CloudFormation::Designer":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"id":聽"a23487d6-a0f3-4787-94b1-6ce2cee3dd46"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽},
聽聽聽聽聽聽聽聽聽聽聽聽"tablepermissions":聽{
聽聽聽聽聽聽聽聽聽聽聽聽"Type":聽"AWS::LakeFormation::Permissions",
聽聽聽聽聽聽聽聽聽聽聽聽"Properties":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DataLakePrincipal":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DataLakePrincipalIdentifier"聽:聽"${aws_iam_role.service_role_glue.arn}"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽},
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"Permissions":聽[
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"ALL"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"PermissionsWithGrantOption":聽[
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"ALL"
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"Resource":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"TableResource":聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"DatabaseName":聽"${element(split(":",aws_glue_catalog_database.glue_database.id),1)}",
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽"TableWildcard"聽:聽{}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}
Thank you @colonmelvin! I almost dig my way down to the rabbit hole of custom resource and do it through manual API call 馃
Even when I temporarily test with the relax glue:* and lakeformation:* permission on my role to all the resources, I did not have the grantable lake formation on CF Execute Role. After reading your comment to make sure I have all the permission, just to be safe, I added Grantable: Super on the CF Execute Role so it can grant permission to other users, then everything is hunky-dory.
One thing that I still wrap my head around is that even when I have
IAMAllowedPrincipals group on the Database permissionSuper grantable permission on the DatabaseI still need the Super grantable permission on ALL Tables for it to work. I don't need this if I specify a table name by the way 馃
Anyway. Appreciated your help! 馃檹
I have just tested it. The feature is available.
On the other hand, the cloudformation documentation is not up to date.
To avoid this confusion, can you please update the documentation here please https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lakeformation-permissions-tablewildcard.html?

Thank you