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

azurerm_data_factory_dataset_delimited_text: Expose compression_codec #10182

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,21 @@ func resourceDataFactoryDatasetDelimitedText() *schema.Resource {
},
},

"compression_codec": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"bzip2",
"gzip",
"deflate",
"ZipDeflate",
"TarGzip",
"Tar",
"snappy",
"lz4",
}, false),
},

"compression_level": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -289,6 +304,7 @@ func resourceDataFactoryDatasetDelimitedTextCreateUpdate(d *schema.ResourceData,
FirstRowAsHeader: d.Get("first_row_as_header").(bool),
NullValue: d.Get("null_value").(string),
CompressionLevel: d.Get("compression_level").(string),
CompressionCodec: d.Get("compression_codec").(string),
}

linkedServiceName := d.Get("linked_service_name").(string)
Expand Down Expand Up @@ -469,6 +485,12 @@ func resourceDataFactoryDatasetDelimitedTextRead(d *schema.ResourceData, meta in
} else {
d.Set("compression_level", compressionLevel)
}
compressionCodec, ok := properties.CompressionCodec.(string)
if !ok {
log.Printf("[DEBUG] skipping `compression_codec` since it's not a string")
} else {
d.Set("compression_codec", compressionCodec)
}
}

if folder := delimited_textTable.Folder; folder != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestAccDataFactoryDatasetDelimitedText_http_update(t *testing.T) {
check.That(data.ResourceName).Key("schema_column.#").HasValue("1"),
check.That(data.ResourceName).Key("additional_properties.%").HasValue("2"),
check.That(data.ResourceName).Key("description").HasValue("test description"),
check.That(data.ResourceName).Key("compression_codec").HasValue("gzip"),
check.That(data.ResourceName).Key("compression_level").HasValue("Optimal"),
),
},
Expand All @@ -59,7 +60,8 @@ func TestAccDataFactoryDatasetDelimitedText_http_update(t *testing.T) {
check.That(data.ResourceName).Key("schema_column.#").HasValue("2"),
check.That(data.ResourceName).Key("additional_properties.%").HasValue("1"),
check.That(data.ResourceName).Key("description").HasValue("test description 2"),
check.That(data.ResourceName).Key("compression_level").HasValue("Fastest"),
check.That(data.ResourceName).Key("compression_codec").HasValue("lz4"),
check.That(data.ResourceName).Key("compression_level").HasValue("Optimal"),
katbyte marked this conversation as resolved.
Show resolved Hide resolved
),
},
data.ImportStep(),
Expand Down Expand Up @@ -197,6 +199,8 @@ resource "azurerm_data_factory_dataset_delimited_text" "test" {

folder = "testFolder"

compression_codec = "gzip"

compression_level = "Optimal"

parameters = {
Expand Down Expand Up @@ -268,6 +272,8 @@ resource "azurerm_data_factory_dataset_delimited_text" "test" {

folder = "testFolder"

compression_codec = "lz4"

compression_level = "Fastest"

parameters = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ The following supported arguments are specific to Delimited Text Dataset:

* `null_value` - (Required) The null value string.

* `compression_codec` - (Optional) The compression codec used to read/write text files. Valid values are `bzip2`, `gzip`, `deflate`, `ZipDeflate`, `TarGzip`, `Tar`, `snappy`, or `lz4`. Please note these values are case sensitive.

* `compression_level` - (Optional) The compression ratio for the Data Factory Dataset. Valid values are `Fastest` or `Optimal`. Please note these values are case sensitive.

---
Expand Down