diff --git a/azure-test/tests/azure_logic_app_workflow/test-list-query.sql b/azure-test/tests/azure_logic_app_workflow/test-list-query.sql index 0f1c1bc4..ba40e08c 100644 --- a/azure-test/tests/azure_logic_app_workflow/test-list-query.sql +++ b/azure-test/tests/azure_logic_app_workflow/test-list-query.sql @@ -1,3 +1,3 @@ select name, id, type from azure.azure_logic_app_workflow -where name = '{{ resourceName }}'; \ No newline at end of file +where id = '{{ output.resource_id.value }}'; \ No newline at end of file diff --git a/azure/table_azure_logic_app_workflow.go b/azure/table_azure_logic_app_workflow.go index fab411f2..367809ff 100644 --- a/azure/table_azure_logic_app_workflow.go +++ b/azure/table_azure_logic_app_workflow.go @@ -88,7 +88,7 @@ func tableAzureLogicAppWorkflow(_ context.Context) *plugin.Table { Name: "access_control", Description: "The access control configuration.", Type: proto.ColumnType_JSON, - Transform: transform.FromField("WorkflowProperties.AccessControl"), + Transform: transform.From(extractAccessControl), }, { Name: "definition", @@ -282,3 +282,23 @@ func listLogicAppWorkflowDiagnosticSettings(ctx context.Context, d *plugin.Query } return diagnosticSettings, nil } + +//// TRANSFORM FUNCTION + +// Access Control configuration for any IP is coming as "{}" instead of nil if we are not providing any IP in configuration +func extractAccessControl(ctx context.Context, d *transform.TransformData) (interface{}, error) { + data := d.HydrateItem.(logic.Workflow) + if data.WorkflowProperties != nil { + if data.WorkflowProperties.AccessControl == nil { + return nil, nil + } else { + // Due to inconsistency in the API behaviour we need this check. + if data.WorkflowProperties.AccessControl.Actions != nil || data.WorkflowProperties.AccessControl.Contents != nil || data.WorkflowProperties.AccessControl.Triggers != nil || data.WorkflowProperties.AccessControl.WorkflowManagement != nil { + return data.WorkflowProperties.AccessControl, nil + } else { + return nil, nil + } + } + } + return data.AccessControl, nil +}