Skip to content

Extend --name-pattern: Support per-resource placeholders#664

Open
magodo wants to merge 2 commits into
Azure:mainfrom
magodo:resource_name_pattern_ext
Open

Extend --name-pattern: Support per-resource placeholders#664
magodo wants to merge 2 commits into
Azure:mainfrom
magodo:resource_name_pattern_ext

Conversation

@magodo

@magodo magodo commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Extend --name-pattern beyond the incremental index (*) to support a
set of per-resource placeholders, expanded from the parsed Azure
resource id (via armid):

  • {type} - last Azure resource type segment (e.g. virtual_machines)
  • {rp} - resource provider namespace (e.g. microsoft_compute)
  • {name} - last name segment of the resource id
  • {root_scope} - root scope name (e.g. resource group name)

Placeholder values are snake_cased and sanitized to valid Terraform
identifiers. The * index is now tracked per expanded prefix/suffix,
so e.g. --name-pattern '{type}*' yields virtual_machines0,
virtual_machines1, virtual_networks0, ... — producing more
meaningful addresses like azapi_resource.virtual_machines0 instead
of azapi_resource.res-0.

magodo added 2 commits June 19, 2026 20:32
Extend `--name-pattern` beyond the incremental index (`*`) to support a
set of per-resource placeholders, expanded from the parsed Azure
resource id (via armid):

 - `{type}`       - last Azure resource type segment (e.g. virtual_machines)
 - `{rp}`         - resource provider namespace    (e.g. microsoft_compute)
 - `{name}`       - last name segment of the resource id
 - `{root_scope}` - root scope name (e.g. resource group name)

Placeholder values are snake_cased and sanitized to valid Terraform
identifiers. The `*` index is now tracked per expanded prefix/suffix,
so e.g. `--name-pattern '{type}*'` yields `virtual_machines0`,
`virtual_machines1`, `virtual_networks0`, ... — producing more
meaningful addresses like `azapi_resource.virtual_machines0` instead
of `azapi_resource.res-0`.
@magodo magodo changed the title Extend --name-pattern: Support per-resource placeholders. Extend --name-pattern: Support per-resource placeholders Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant