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 table state does not refresh correctly #27601

Open vwightman opened 1 year ago

vwightman commented 1 year ago

Terraform Core Version

1.2.9

AWS Provider Version

4.37.0

Affected Resource(s)

aws_lakeformation_resource_lf_tags resource=table

Expected Behavior

Successfully attaches a lake formation tag to a table.

If the tag is removed from the table outside of terraform (from the console), terraform should identify the change as part of terraform plan and terraform apply commands.

Actual Behavior

When the tag that has been added to a table with the terraform apply is removed from the table outside of terraform the terraform plan and terraform apply commands do not identify any changes to the resource

Relevant Error/Panic Output Snippet

module.lf_table_tag["xxx"].aws_lakeformation_resource_lf_tags.table_tag: Refreshing state... [id=4205110908]

No changes. Your infrastructure matches the configuration.

Terraform Configuration Files

resource "aws_lakeformation_resource_lf_tags" "table_tag" {
  catalog_id = "catalog_id"

  table {
    catalog_id    = "xxxx"
    database_name = "database_name"
    name          = "table_name"
  }

  lf_tag {
    catalog_id = "catalog_id"
    key        = "tag_key"
    value      = "tag_value"
  }
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

Looking at AWS Cloudtrail, it looks like terraform is retrieving the table's tag information via the api:

...
    "eventSource": "lakeformation.amazonaws.com",
    "eventName": "GetResourceLFTags",
    "awsRegion": "us-east-2",
    "sourceIPAddress": "47.215.243.76",
    "userAgent": "APN/1.0 HashiCorp/1.0 Terraform/1.2.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.123 (go1.18.4; windows; amd64)",
    "requestParameters": {
        "catalogId": "CATALOG_ID",
        "resource": {
            "table": {
                "catalogId": "CATALOG_ID",
                "databaseName": "DATABASE_NAME",
                "name": "TABLE_NAME"
            }
        },
        "showAssignedLFTags": true
    },
...

After the Lake Formation tag is removed from the table, this API call returns nothing (no content at all). Maybe the nothing is messing up the resource retrieval?

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue