-
Notifications
You must be signed in to change notification settings - Fork 16
feat(shortcut): add new shortcut_conflict_policy for fabric_shortcut #770
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
base: main
Are you sure you want to change the base?
Conversation
Changelog Previewv1.7.1-dev - December 10, 2025β¨ Added
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new shortcut_conflict_policy attribute to the fabric_shortcut resource, enabling users to control how conflicts are handled when a shortcut with the same name and path already exists. The attribute accepts values like Abort, CreateOrOverwrite, GenerateUniqueName, and OverwriteOnly, with Abort as the default.
Key Changes:
- Added
shortcut_conflict_policyoptional string attribute to the resource schema with enum validation - Updated resource Create, Update, and Read methods to handle the new policy parameter
- Extended the model to include the new field and properly serialize it to API requests
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
internal/services/shortcut/schema.go |
Adds the shortcut_conflict_policy attribute definition to the schema with validators for allowed enum values |
internal/services/shortcut/models.go |
Extends resourceShortcutModel with the new field and implements setter/getter methods to handle the policy parameter |
internal/services/shortcut/resource_shortcut.go |
Updates Create, Update, and Read operations to use the new conflict policy parameter when interacting with the API |
internal/services/shortcut/resource_shortcut_test.go |
Adds test coverage for the new attribute in the acceptance test's Create step |
examples/resources/fabric_shortcut/resource.tf |
Adds example usage of the new shortcut_conflict_policy attribute with a comment explaining the default behavior |
docs/resources/shortcut.md |
Documents the new optional attribute with its description and valid values |
docs/data-sources/shortcuts.md |
Documents the attribute for the data source (though this may be incorrect as it's a write-only parameter) |
docs/data-sources/shortcut.md |
Documents the attribute for the data source (though this may be incorrect as it's a write-only parameter) |
.changes/unreleased/added-20251209-215321.yaml |
Changelog entry documenting the new feature |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/services/shortcut/schema.go
Outdated
| DataSource: &schemaD.StringAttribute{ | ||
| Computed: false, | ||
| Optional: true, | ||
| }, |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shortcut_conflict_policy attribute should not be included in the DataSource schema. This is a write-only parameter that controls behavior during resource creation/updates and is not returned by the API during reads. Data sources should only include attributes that can be read from the API.
Consider removing the entire DataSource section from this attribute definition (lines 94-97).
| DataSource: &schemaD.StringAttribute{ | |
| Computed: false, | |
| Optional: true, | |
| }, |
| "shortcut_conflict_policy": string(fabcore.ShortcutConflictPolicyGenerateUniqueName), | ||
| "path": "Tables", |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should verify that the shortcut_conflict_policy attribute is properly set in the resource. Consider adding a test assertion after line 450 to check that the attribute value matches the expected value, for example:
resource.TestCheckResourceAttr(testResourceItemFQN, "shortcut_conflict_policy", string(fabcore.ShortcutConflictPolicyGenerateUniqueName)),This ensures the new attribute is properly persisted and can be read back from the state.
docs/data-sources/shortcuts.md
Outdated
|
|
||
| Optional: | ||
|
|
||
| - `shortcut_conflict_policy` (String) When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'. |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since shortcut_conflict_policy is a write-only parameter used only during resource creation/updates, it should not be documented as an attribute for the data source. This attribute is not returned by the API and cannot be read.
This documentation should be removed unless the schema is corrected to exclude this attribute from data sources.
| - `shortcut_conflict_policy` (String) When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'. |
docs/data-sources/shortcut.md
Outdated
|
|
||
| ### Optional | ||
|
|
||
| - `shortcut_conflict_policy` (String) When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'. |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since shortcut_conflict_policy is a write-only parameter used only during resource creation/updates, it should not be documented as an attribute for the data source. This attribute is not returned by the API and cannot be read.
This documentation should be removed unless the schema is corrected to exclude this attribute from data sources.
| - `shortcut_conflict_policy` (String) When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'. |
internal/services/shortcut/schema.go
Outdated
| }, | ||
| "shortcut_conflict_policy": superschema.StringAttribute{ | ||
| Common: &schemaR.StringAttribute{ | ||
| MarkdownDescription: "When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'", |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The markdown description is missing a period at the end. For consistency with other attribute descriptions in the schema, add a period:
MarkdownDescription: "When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'.",| MarkdownDescription: "When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'", | |
| MarkdownDescription: "When provided, it defines the action to take when a shortcut with the same name and path already exists. The default action is 'Abort'.", |
Minimum allowed line rate is |
π₯ Pull Request
β What are you trying to address
This onboards new
shortcut_conflict_policyattribute forfabric_shortcut. Closes #765