azapi.getResourceId
Explore with Pulumi AI
This resource can parse an Azure resource ID into its separate fields.
Example Usage
terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}
provider "azapi" {
}
data "azapi_resource_id" "account" {
  type        = "Microsoft.Automation/automationAccounts@2021-06-22"
  resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Automation/automationAccounts/automationAccount1"
}
output "account_name" {
  value = data.azapi_resource_id.account.name
}
output "account_resource_group" {
  value = data.azapi_resource_id.account.resource_group_name
}
output "account_subscription" {
  value = data.azapi_resource_id.account.subscription_id
}
output "account_parent_id" {
  value = data.azapi_resource_id.account.parent_id
}
data "azapi_resource_id" "vnet" {
  type      = "Microsoft.Network/virtualNetworks@2021-02-01"
  parent_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1"
  name      = "vnet1"
}
output "vnet_id" {
  value = data.azapi_resource_id.vnet.id
}
output "vnet_resource_group" {
  value = data.azapi_resource_id.vnet.resource_group_name
}
output "vnet_subscription" {
  value = data.azapi_resource_id.vnet.subscription_id
}
Using getResourceId
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getResourceId(args: GetResourceIdArgs, opts?: InvokeOptions): Promise<GetResourceIdResult>
function getResourceIdOutput(args: GetResourceIdOutputArgs, opts?: InvokeOptions): Output<GetResourceIdResult>def get_resource_id(name: Optional[str] = None,
                    parent_id: Optional[str] = None,
                    resource_id: Optional[str] = None,
                    type: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetResourceIdResult
def get_resource_id_output(name: Optional[pulumi.Input[str]] = None,
                    parent_id: Optional[pulumi.Input[str]] = None,
                    resource_id: Optional[pulumi.Input[str]] = None,
                    type: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetResourceIdResult]func GetResourceId(ctx *Context, args *GetResourceIdArgs, opts ...InvokeOption) (*GetResourceIdResult, error)
func GetResourceIdOutput(ctx *Context, args *GetResourceIdOutputArgs, opts ...InvokeOption) GetResourceIdResultOutput> Note: This function is named GetResourceId in the Go SDK.
public static class GetResourceId 
{
    public static Task<GetResourceIdResult> InvokeAsync(GetResourceIdArgs args, InvokeOptions? opts = null)
    public static Output<GetResourceIdResult> Invoke(GetResourceIdInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetResourceIdResult> getResourceId(GetResourceIdArgs args, InvokeOptions options)
public static Output<GetResourceIdResult> getResourceId(GetResourceIdArgs args, InvokeOptions options)
fn::invoke:
  function: azapi:index/getResourceId:getResourceId
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Type string
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- Name string
- Specifies the name of the azure resource.
- ParentId string
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- ResourceId string
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
- Type string
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- Name string
- Specifies the name of the azure resource.
- ParentId string
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- ResourceId string
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
- type String
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- name String
- Specifies the name of the azure resource.
- parentId String
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- resourceId String
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
- type string
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- name string
- Specifies the name of the azure resource.
- parentId string
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- resourceId string
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
- type str
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- name str
- Specifies the name of the azure resource.
- parent_id str
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- resource_id str
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
- type String
- It is in a format like <resource-type>@<api-version>.<resource-type>is the Azure resource type, for example,Microsoft.Storage/storageAccounts.<api-version>is version of the API used to manage this azure resource.
- name String
- Specifies the name of the azure resource.
- parentId String
- The ID of the azure resource in which this resource is created. It supports different kinds of deployment scope for top level resources: - resource group scope: parent_idshould be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
- management group scope: parent_idshould be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
- extension scope: parent_idshould be the ID of the resource you're adding the extension to.
- subscription scope: parent_idshould be like/subscriptions/00000000-0000-0000-0000-000000000000
- tenant scope: parent_idshould be/
 - For child level resources, the - parent_idshould be the ID of its parent resource, for example, subnet resource's- parent_idis the ID of the vnet.
- resource group scope: 
- resourceId String
- The ID of an existing azure source. - Note: Configuring - nameand- parent_idis an alternative way to configure- resource_id.
getResourceId Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the azure resource.
- ParentId string
- The ID of the azure resource in which this resource is created.
- Parts Dictionary<string, string>
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- ProviderNamespace string
- The azure resource provider namespace of the azure resource.
- ResourceGroup stringName 
- The resource group name of the azure resource.
- ResourceId string
- SubscriptionId string
- The subscription ID of the azure resource.
- Type string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the azure resource.
- ParentId string
- The ID of the azure resource in which this resource is created.
- Parts map[string]string
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- ProviderNamespace string
- The azure resource provider namespace of the azure resource.
- ResourceGroup stringName 
- The resource group name of the azure resource.
- ResourceId string
- SubscriptionId string
- The subscription ID of the azure resource.
- Type string
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the azure resource.
- parentId String
- The ID of the azure resource in which this resource is created.
- parts Map<String,String>
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- providerNamespace String
- The azure resource provider namespace of the azure resource.
- resourceGroup StringName 
- The resource group name of the azure resource.
- resourceId String
- subscriptionId String
- The subscription ID of the azure resource.
- type String
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the azure resource.
- parentId string
- The ID of the azure resource in which this resource is created.
- parts {[key: string]: string}
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- providerNamespace string
- The azure resource provider namespace of the azure resource.
- resourceGroup stringName 
- The resource group name of the azure resource.
- resourceId string
- subscriptionId string
- The subscription ID of the azure resource.
- type string
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the azure resource.
- parent_id str
- The ID of the azure resource in which this resource is created.
- parts Mapping[str, str]
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- provider_namespace str
- The azure resource provider namespace of the azure resource.
- resource_group_ strname 
- The resource group name of the azure resource.
- resource_id str
- subscription_id str
- The subscription ID of the azure resource.
- type str
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the azure resource.
- parentId String
- The ID of the azure resource in which this resource is created.
- parts Map<String>
- The map of the resource ID parts, where the key is the part name and the value is the part value. e.g. virtualNetworks=myVnet.
- providerNamespace String
- The azure resource provider namespace of the azure resource.
- resourceGroup StringName 
- The resource group name of the azure resource.
- resourceId String
- subscriptionId String
- The subscription ID of the azure resource.
- type String
Package Details
- Repository
- azapi dirien/pulumi-azapi
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azapiTerraform Provider.