Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_glue_partition partition_values reordered during terraform apply #16718

Closed
dan8596738459 opened this issue Dec 11, 2020 · 2 comments · Fixed by #17344
Closed

aws_glue_partition partition_values reordered during terraform apply #16718

dan8596738459 opened this issue Dec 11, 2020 · 2 comments · Fixed by #17344
Labels
bug Addresses a defect in current functionality. service/glue Issues and PRs that pertain to the glue service.
Milestone

Comments

@dan8596738459
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.14.2

  • provider registry.terraform.io/hashicorp/aws v3.20.0

Affected Resource(s)

  • aws_glue_partition

Terraform Configuration Files

provider "aws" {
  region = "eu-west-2"
}

resource "aws_glue_catalog_database" "database" {
  name = "database"
}

resource "aws_glue_catalog_table" "table" {
  name          = "table"
  database_name = aws_glue_catalog_database.database.name

  table_type = "EXTERNAL_TABLE"

  parameters = {
    classification = "parquet"
  }

  partition_keys {
    name = "year"
    type = "string"
  }
  partition_keys {
    name = "month"
    type = "string"
  }
  partition_keys {
    name = "day"
    type = "string"
  }

  storage_descriptor {
    location      = "s3://example-bucket"
    input_format  = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat"
    output_format = "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat"

    ser_de_info {
      serialization_library = "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"

      parameters = {
        "serialization.format" = 1
      }
    }

    columns {
      name = "example_column"
      type = "bigint"
    }
  }
}

resource "aws_glue_partition" "partition" {
  database_name    = aws_glue_catalog_database.database.name
  table_name       = aws_glue_catalog_table.table.name
  partition_values = ["2020", "12", "11"]
}

Expected Behavior

A new partition in the glue table database.table with partition keys of:

  • year=2020
  • month=12
  • day=11

Actual Behavior

A new partition in the glue table database.table with partition keys of:

  • year=12
  • month=2020
  • day=11

Steps to Reproduce

  1. terraform apply
  2. aws glue get-partitions --database-name database --table-name table or view the partition in the aws console

Additional information

I think this issue is cause by partition_values being defined as a schema.TypeSet instead of a schema.TypeList so terraform is not storing the order correctly but I'm not very familiar with this code and could easily be wrong.

I've also tried reordering the partition_values list but it doesn't seem to have any effect.

@ghost ghost added the service/glue Issues and PRs that pertain to the glue service. label Dec 11, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 11, 2020
@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 28, 2021
@DrFaust92 DrFaust92 self-assigned this Jan 28, 2021
@github-actions github-actions bot added this to the v3.27.0 milestone Feb 4, 2021
@ghost
Copy link

ghost commented Feb 5, 2021

This has been released in version 3.27.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 6, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 6, 2021
@DrFaust92 DrFaust92 removed their assignment Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/glue Issues and PRs that pertain to the glue service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants