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.85k stars 9.19k forks source link

[Bug]: leaving empty `create_table_default_permission` in `aws_glue_catalog_database` does not remove the default IAM_ALLOWED_PRINCIPALS #27295

Open thulasirajkomminar opened 2 years ago

thulasirajkomminar commented 2 years ago

Terraform Core Version

1.3.2

AWS Provider Version

4.35.0

Affected Resource(s)

aws_glue_catalog_database

Expected Behavior

The issue occurs during apply

resource "aws_glue_catalog_database" "default" {
  name = "database"

  create_table_default_permission {}
}

The expected behaviour is when sending the api call to aws should look like

"requestParameters": {
        "catalogId": "*******",
        "name": "database",
        "databaseInput": {
            "name": "database",
            "createTableDefaultPermissions": [
            ]
        }
    }

Actual Behavior

The actual call to aws looks like this

"requestParameters": {
        "catalogId": "*****",
        "name": "database",
        "databaseInput": {
            "name": "database",
            "createTableDefaultPermissions": [
                {}
            ]
        }
    }

which is invalid and results in

"errorCode": "InvalidInputException",
"errorMessage": "Principal in PrincipalPrivileges cannot be null.",

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_glue_catalog_database" "default" {
  name = "database"

  create_table_default_permission {}
}

Steps to Reproduce

resource "aws_glue_catalog_database" "default" {
  name = "database"

  create_table_default_permission {}
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

jar-b commented 1 year ago

Implementation notes: