Extend --name-pattern: Support per-resource placeholders#664
Open
magodo wants to merge 2 commits into
Open
Conversation
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`.
--name-pattern: Support per-resource placeholders.--name-pattern: Support per-resource placeholders
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.
Extend
--name-patternbeyond the incremental index (*) to support aset 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}*'yieldsvirtual_machines0,virtual_machines1,virtual_networks0, ... — producing moremeaningful addresses like
azapi_resource.virtual_machines0insteadof
azapi_resource.res-0.