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

New resource: azurerm_data_factory_dataset_azure_sql_table #23264

Merged
1 change: 1 addition & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
dashboard.Registration{},
databoxedge.Registration{},
databricks.Registration{},
datafactory.Registration{},
digitaltwins.Registration{},
disks.Registration{},
domainservices.Registration{},
Expand Down
43 changes: 40 additions & 3 deletions internal/services/datafactory/data_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func flattenDataFactoryVariables(input map[string]*datafactory.VariableSpecifica

// DatasetColumn describes the attributes needed to specify a structure column for a dataset
type DatasetColumn struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty" tfschema:"name"`
Description string `json:"description,omitempty" tfschema:"description"`
Type string `json:"type,omitempty" tfschema:"type"`
}

func expandDataFactoryDatasetStructure(input []interface{}) interface{} {
Expand Down Expand Up @@ -197,6 +197,43 @@ func flattenDataFactoryStructureColumns(input interface{}) []interface{} {
return output
}

func flattenDataFactoryStructureColumnsToDatasetColumn(input interface{}) []DatasetColumn {
output := make([]DatasetColumn, 0)

columns, ok := input.([]interface{})
if !ok {
return nil
bianyifan marked this conversation as resolved.
Show resolved Hide resolved
}

for _, v := range columns {
column, ok := v.(map[string]interface{})
if !ok {
continue
}
var result DatasetColumn
if column["name"] != nil {
result.Name, ok = column["name"].(string)
if !ok {
continue
}
}
if column["type"] != nil {
result.Type, ok = column["type"].(string)
if !ok {
continue
}
}
if column["description"] != nil {
result.Description, ok = column["description"].(string)
if !ok {
continue
}
}
bianyifan marked this conversation as resolved.
Show resolved Hide resolved
output = append(output, result)
}
return output
}

// DatasetSnowflakeSchemaColumn describes the attributes needed to specify a Snowflake schema column for a dataset
type DatasetSnowflakeSchemaColumn struct {
Name string `json:"name,omitempty"`
Expand Down
Loading