Pass isEnabled to Porter bundles as is_enabled parameter on disable/enable#4909
Draft
Copilot wants to merge 3 commits into
Draft
Pass isEnabled to Porter bundles as is_enabled parameter on disable/enable#4909Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix disabling user resource to stop Azure resources
Pass isEnabled to Porter bundles as is_enabled parameter on disable/enable
May 21, 2026
Collaborator
|
@copilot bump API versions |
Contributor
Author
Collaborator
|
Might be good to implement this in one or multiple of the existing templates so it can be properly tested. A common approach / guidance on what disabling should actually do would be helpful. E.g powering off VMs, deallocating resources? I expect it has to be reversible so no data destruction, but it should also disable access to the resource (e.g nsg/firewall rules etc?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disabling a resource via the TRE API only set a flag in the database —
isEnabledwas never forwarded to the Porter bundle, so Terraform had no mechanism to stop, deallocate, or remove Azure resources on disable.What is being addressed
When a workspace, workspace service, or user resource is disabled, the
upgradeaction is sent to the resource processor but the bundle receives no signal that the resource is being disabled. Bundle authors have no way to conditionally manage Azure resource lifecycle (e.g. delete a VM but keep its disks, or stop a web app to avoid costs).How is this addressed
api_app/models/domain/resource.py: Added"isEnabled": self.isEnabledtoget_resource_request_message_payload()so every Service Bus message carries the current enabled state.resource_processor/helpers/commands.py: Addedis_enabledtoget_special_porter_param_value(), mapping it tomsg_body["isEnabled"]— consistent with howworkspace_id,parent_service_id, andowner_idare already resolved from the message body.docs/tre-workspace-authors/authoring-workspace-templates.md: Added a "Handling resource enable/disable" section documenting theis_enabledparameter convention and aporter.yamlusage example.Bundle authors opt in by declaring
is_enabledinporter.yamland passing it into Terraform:The decision of what to do (delete VM but keep disks, stop a web app, etc.) is intentionally left to each bundle's Terraform, as discussed in the issue.