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
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
34 changes: 31 additions & 3 deletions internal/services/datafactory/data_factory.go
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,34 @@ func flattenDataFactoryStructureColumns(input interface{}) []interface{} {
return output
}

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

columns, ok := input.([]interface{})
if !ok {
return output
}

for _, v := range columns {
column, ok := v.(map[string]interface{})
if !ok {
continue
}
var result DatasetColumn
if column["name"] != nil {
result.Name = column["name"].(string)
}
if column["type"] != nil {
result.Type = column["type"].(string)
}
if column["description"] != nil {
result.Description = column["description"].(string)
}
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