hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Enhancement]: support for aws_lakeformation_permissions hybrid mode opt-in #36353

Open mlnrt opened 3 months ago

mlnrt commented 3 months ago

Description

In order to use Lake Formation hybrid mode, either

Terraform provides hybrid_mode parameter for the aws_lakeformation_resource resource, but there is no such option to create the optin for the permissions, nor there is a resource to create such optin

Affected Resource(s) and/or Data Source(s)

aws_lakeformation_permissions

Potential Terraform Configuration

resource "aws_lakeformation_permissions" "example" {
  principal             = aws_iam_role.workflow_role.arn
  permissions           = ["CREATE_TABLE", "ALTER", "DROP"]
  hybrid_access_enabled = true

  database {
    name       = aws_glue_catalog_database.example.name
    catalog_id = "110376042874"
  }
}

##### OR a new resource

resource "aws_lakeformation_optin" "example" {
  principal   = aws_iam_role.workflow_role.arn

  database {
    name       = aws_glue_catalog_database.example.name
    catalog_id = "110376042874"
  }
}

References

API References: [1] https://docs.aws.amazon.com/lake-formation/latest/APIReference/API_CreateLakeFormationOptIn.html [2] https://docs.aws.amazon.com/lake-formation/latest/dg/aws-lake-formation-api-hybrid-access-mode.html

Documentation: Setting up hybrid access mode - common scenarios [3] https://docs.aws.amazon.com/lake-formation/latest/dg/hybrid-access-setup.html

Would you like to implement a fix?

None

github-actions[bot] commented 3 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

nickdelnano commented 3 months ago

From the Naming Guide this should be its own resource. The schema for opt in is a near subset of aws_lakeformation_resource_lf_tag. Includes Database and Table and an addition of principal.