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.76k stars 9.11k forks source link

[Enhancement]: r/aws_glue_catalog_table_optimizer Add support for expiring snapshots and orphan file deletion #39405

Open nickdelnano opened 5 days ago

nickdelnano commented 5 days ago

Description

AWS has released new features to Glue table optimizers to managed storage. This issue tracks adding the new features to aws_glue_catalog_table_optimizer resource.

aws_glue_catalog_table_optimizer resource was added in https://github.com/hashicorp/terraform-provider-aws/pull/38052.

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

aws_glue_catalog_table_optimizer

Potential Terraform Configuration


# Compaction (already exists)
resource "aws_glue_catalog_table_optimizer" "example" {
  catalog_id    = "123456789012"
  database_name = "example_database"
  table_name    = "example_table"
  configuration {
    role_arn = "arn:aws:iam::123456789012:role/example-role"
    enabled  = true
  }
  type = "compaction"
}

# Snapshot expiration (new)
resource "aws_glue_catalog_table_optimizer" "example" {
  catalog_id    = "123456789012"
  database_name = "example_database"
  table_name    = "example_table"
  configuration {
    role_arn = "arn:aws:iam::123456789012:role/example-role"
    enabled  = true
    retentionConfiguration {
      icebergConfiguration {
        snapshotRetentionPeriodInDays = 1
        numberOfSnapshotsToRetain = 2
        cleanExpiredFiles = true
      }
    }
  }
  type = "retention"
}

# Orphan file removal (new)
resource "aws_glue_catalog_table_optimizer" "example" {
  catalog_id    = "123456789012"
  database_name = "example_database"
  table_name    = "example_table"
  configuration {
    role_arn = "arn:aws:iam::123456789012:role/example-role"
    enabled  = true
    orphanFileDeletionConfiguration {
      icebergConfiguration {
        orphanFileRetentionPeriodInDays = 5
        location = "s3://example-bucket/path"
      }
    }
  }
  type = "orphan_file_deletion"
}

References

CreateTableOptimizer API docs https://docs.aws.amazon.com/glue/latest/webapi/API_CreateTableOptimizer.html UpdateTableOptimizer API docs https://docs.aws.amazon.com/glue/latest/webapi/API_UpdateTableOptimizer.html

The individual API docs aren't updated yet but the Table Optimizer API docs are:

Would you like to implement a fix?

None

github-actions[bot] commented 5 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue