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.63k stars 9.01k forks source link

[Bug]: aws_lakeformation_resource_lf_tags can not be applied to all columns in a table using wildcard #35547

Open prithvi514 opened 5 months ago

prithvi514 commented 5 months ago

Terraform Core Version

1.6.2

AWS Provider Version

5.34.0

Affected Resource(s)

When creating aws_lakeformation_resource_lf_tags tags on all columns in a table, specifying wildcard alone without column_names is not working as expected.

The goal is to not specify individual/all column names and just use the wildcard = true flag but Terraform is expecting column names

Expected Behavior

resource "aws_lakeformation_resource_lf_tags" "all_columns_tag" {
  table_with_columns {
    database_name         = "my_database"
    name                  = "my_table"
    excluded_column_names = ["col2"]
    wildcard              = true
  }

  lf_tag {
    key   = "example_key"
    value = "example_value"
  }
}

This should tag all columns in the specified table except for col2 with the specified lf_tag

Actual Behavior

│ Error: creating AWS Lake Formation Resource LF Tags ({
│   LFTags: [{
│       TagKey: "example_key",
│       TagValues: ["example_value"]
│     }],
│   Resource: {
│     TableWithColumns: {
│       ColumnWildcard: {
│         ExcludedColumnNames: ["col2"]
│       },
│       DatabaseName: "my_database",
│       Name: "my_table"
│     }
│   }
│ }): InvalidInputException: Must provide column names for table resource.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_lakeformation_lf_tag" "product" {
  key    = "example_key"                // The key for the tag
  values = ["example_value", "example_value1", "example_value2"] // The values for the tag
}

Steps to Reproduce

  1. Create LakeFormation tag resource https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lakeformation_lf_tag

    resource "aws_lakeformation_lf_tag" "tag1" {
    key    = "example_key"                // The key for the tag
    values = ["example_value", "example_value1", "example_value2"] // The values for the tag
    }
  2. Apply LakeFormation tags to a particular table with table_with_columns parameter and exclude_column_names parameter https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lakeformation_permissions#table_with_columns

resource "aws_lakeformation_resource_lf_tags" "all_columns_tag" {
  table_with_columns {
    database_name         = "my_database"
    name                  = "my_table"
    excluded_column_names = ["col2"]
    wildcard              = true
  }

  lf_tag {
    key   = "example_key"
    value = "example_value"
  }
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 5 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 5 months ago

Similar #31429