[Hubs] Pass hub options to newHub() as an object instead of positional arguments
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- azure
- Domain
- infrastructure
Research direction
Start with src/templates/finops-hub/modules/fx/hub-types.bicep, then inspect the sole caller in modules/hub.bicep. Confirm whether #2249 has merged before including its Key Vault RBAC option, and update both function signatures and the caller to pass named options. Validate the Bicep templates and verify that the deployed resources remain unchanged.
Written by the indexing model from the issue text.
Description
📝 Scenario
newHub() and newHubInternal() in src/templates/finops-hub/modules/fx/hub-types.bicep take all hub options as positional arguments. newHub() has 12 parameters today and newHubInternal() has 15, many of them adjacent values of the same type (storageSku/keyVaultSku, and a run of bool flags such as keyVaultEnablePurgeProtection, enableInfrastructureEncryption, enablePublicAccess, enableNatGateway).
Every new hub option adds another positional argument, often inserted in the middle of the signature. #2249 does that with keyVaultEnableRbacAuthorization. If two arguments of the same type end up in the wrong order at a call site, the template still compiles, and the hub is silently configured wrong (for example, purge protection and infrastructure encryption swapped).
There's only one caller today (modules/hub.bicep), so the risk is contained for now, but it grows with each option.
This came up during the review of #2249 and was agreed to be out of scope there.
💎 Solution
Change newHub() and newHubInternal() to take the options as a single typed object parameter, for example a HubOptions user-defined type, so call sites name each option:
var hub = newHub(hubName, location, {
tags: tags
tagsByResource: tagsByResource
storageSku: storageSku
keyVaultSku: keyVaultSku
keyVaultEnablePurgeProtection: enablePurgeProtection
enableInfrastructureEncryption: enableInfrastructureEncryption
enablePublicAccess: enablePublicAccess
enableNatGateway: enableNatGateway
networkAddressPrefix: virtualNetworkAddressPrefix
isTelemetryEnabled: enableDefaultTelemetry
})
If a full refactor isn't wanted, the minimum is a convention that new options are appended at the end of the signature instead of being inserted in the middle.
This is an internal refactoring with no change to deployed resources. It's best done after #2249 merges, so it includes the Key Vault RBAC option.
- Dominant language
- PowerShell
- Stars
- 614
- Forks
- 260
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/finops-toolkit
-
monthly-cost-change-percentage returns inf when the prior month is zeroPossibly taken @RolandKrummenacher claimed this 36 days ago. OpenMicro PR 🔬 Skill: KQL Status: 🔬 Code review Tool: FinOps hubs Type: Bug 🐛
Difficulty 1/5 Under an hour Newbie friendliness 90/100
microsoft/finops-toolkit#2323 · 1 comment ·
Maintainers usually reply within 6 days
-
Needs: Triage 🔍
Difficulty 4/5 1-2 days Newbie friendliness 42/100
microsoft/finops-toolkit#2363 · 1 comment ·
Maintainers usually reply within 6 days
-
[aw] No-Op RunsOpenagentic-workflows Needs: Triage 🔍
Difficulty 5/5 Over a week Newbie friendliness 1/100
microsoft/finops-toolkit#2362 · 2 comments ·
Maintainers usually reply within 6 days
-
Harden PR deployment and cleanup before the November 2 event-policy deadlinePossibly taken @MSBrett claimed this 3 days ago. OpenNeeds: Triage 🔍
Difficulty 4/5 3-5 days Newbie friendliness 34/100
microsoft/finops-toolkit#2360 · 1 comment ·
Maintainers usually reply within 6 days
-
Initialize GitHub Agentic Workflows with link-checker, ai-moderator, repo-assist, pr-review, and docs-updater workflowsPossibly taken @MSBrett claimed this 3 days ago. OpenNeeds: Triage 🔍
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/finops-toolkit#2357 · 1 comment ·
Maintainers usually reply within 6 days
All issues in microsoft/finops-toolkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
MISP/misp-workbench#496 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
praetorianer777/Dynamo#53 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MISP/misp-docker#478 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
IBM/cloud-pak-deployer#1205 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nuts-foundation/nuts-admin#344 ·
Maintainers usually reply within 5 days