Panic listing a resource group with an Azure SQL Elastic Job agent: invalid input in armid.formatScope
A pull request for this has already been merged.
- #691 by @magodo — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The report identifies internal/populate/populate_mssql_job.go:31-32 and the matching line in internal/populate/populate_stream_analytics_job.go:36 in aztft. Read those append operations, then run the resource group listing command described in the issue with the fix built in; done means it exits successfully and exports the listed resources without panicking.
Written by the indexing model from the issue text.
Description
Version
aztfexport v0.20.0 (d52e1c5), with aztft at v0.3.1-0.20260625235534-b710d5ecffdc.
What happens
Listing a resource group that holds an Azure SQL Elastic Job agent with a scheduled job panics:
aztfexport rg --non-interactive --plain-ui --generate-mapping-file -o <dir> <resource-group>
panic: invalid input: len([servers jobAgents jobs schedules]) != len([servers jobAgents jobs schedules default])
github.com/magodo/armid.formatScope(...)
github.com/magodo/[email protected]/armid.go:888
github.com/magodo/armid.(*ScopedResourceId).String(...)
github.com/magodo/[email protected]/armid.go:764
github.com/magodo/aztft/aztft.queryType.func1(...)
github.com/magodo/[email protected]/aztft/aztft.go:168
The process exits with code 2, so nothing is exported from that resource group.
Cause
In aztft, internal/populate/populate_mssql_job.go:31-32:
sid.AttrTypes = append(sid.AttrTypes, "schedules")
sid.AttrNames = append(sid.AttrTypes, "default")
The second line appends to AttrTypes where AttrNames is meant, so AttrNames ends up one element longer than AttrTypes and String() panics.
internal/populate/populate_stream_analytics_job.go:36 has the same pattern. We have not run that path. Both lines are still present at aztft head (1e6fd26).
Fix we tested
Changing AttrTypes to AttrNames on the right-hand side of both lines, built against the aztft commit above. The same command then exits 0, and the mapping file lists the agent, its jobs, schedules, steps and target groups. Exporting the azurerm_mssql_* resources from that mapping with --hcl-only also runs without a panic.
Could this go into aztft and a new aztfexport release?
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 223
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No 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 Azure/aztfexport
-
question
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Azure/aztfexport#676 · 1 comment ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Azure/aztfexport#663 · 3 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Azure/aztfexport#652 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Azure/aztfexport#649 · 1 reaction ·
-
upstream-provider
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Azure/aztfexport#637 · 1 comment · 1 reaction ·
All issues in Azure/aztfexport
Similar issues
-
area/docs framework/hugo help wanted language/markdown
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openclaw/crabbox#3060 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
kubeflow/semantic-operator#52 ·
Maintainers usually reply within 10 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PramodBasavarajMenasi/siftwise#52 ·
Maintainers usually reply within 1 day