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

[FEAT] fabric_notebook support for .py file as definition source #168

Open
1 task done
arildandas opened this issue Dec 22, 2024 · 1 comment
Open
1 task done
Labels
enhancement Enhancement to existing feature type/RS-DEF Fabric Item resource with definition

Comments

@arildandas
Copy link

arildandas commented Dec 22, 2024

🚀 Feature description

As fabric notebook content is integrated with git as notebook-content.py files, it is very inconvenient that the only supported file format for definition source is .ipynb. One of the main uecases for this terraform resource is to deploy it from a git branch to the next environment, ie. Test or Prod.
To make this process more seemless with this terraform resource it would be extremly useful if one could point directly to the .py file. like this example:

resource "fabric_notebook" "example_definition_update" {
  display_name = "example"
  description  = "example with definition update when source or tokens changed"
  workspace_id = "00000000-0000-0000-0000-000000000000"
  definition = {
    "notebook-content.py" = {
      source = "${local.path}/notebook-content.py"
      tokens = {
        "MESSAGE" = "World"
        "MyValue" = "Lorem Ipsum"
      }
    }
  }
} 

🔈 Motivation

The deployment process using terraform resource for notebooks based on git source would be much more seemless and straight forward to use.

🛰 Alternatives

Alternative deployment with Fabric REST API can be used, but is more cumbersome:
REST API doc: https://learn.microsoft.com/en-us/rest/api/fabric/notebook/items/update-notebook-definition?tabs=HTTP

Example API usage with .py source:

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/notebooks/5b218778-e7a5-4d73-8187-f10824047715/updateDefinition?updateMetadata=True
{
  "definition": {
    "parts": [
      {
        "path": "notebook-content.py",
        "payload": "IyBGYWJyaWMgbm90ZWJv...",
        "payloadType": "InlineBase64"
      },
      {
        "path": ".platform",
        "payload": "ZG90UGxhdGZvcm1CYXNlNjRTdHJpbmc=",
        "payloadType": "InlineBase64"
      }
    ]
  }
}

🚧 Potential Configuration / Desired Solution

resource "fabric_notebook" "example_definition_update" {
  display_name = "example"
  description  = "example with definition update when source or tokens changed"
  workspace_id = "00000000-0000-0000-0000-000000000000"
  definition = {
    "notebook-content.py" = {
      source = "${local.path}/notebook-content.py"
      tokens = {
        "MESSAGE" = "World"
        "MyValue" = "Lorem Ipsum"
      }
    }
  }
}

📎 Additional context

No response

☑️ Acceptance Criteria

The fabric_notebook resource can be used with notebook-content.py source as integrated with fabric git as the sample config described Potential Configuration above

🔰 Code of Conduct

  • I agree to follow this project's Code of Conduct.
@arildandas arildandas added the feature New feature or request label Dec 22, 2024
@DariuszPorowski DariuszPorowski added enhancement Enhancement to existing feature type/RS-DEF Fabric Item resource with definition and removed feature New feature or request labels Dec 23, 2024
@DariuszPorowski
Copy link
Member

Hi @arildandas Thank you for the feature request. It's a valid idea. Will bring this to the design discussion with the team (most likely after the holiday season).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing feature type/RS-DEF Fabric Item resource with definition
Projects
None yet
Development

No branches or pull requests

2 participants