azapi logo
AzAPI v1.6.0, May 19 23

azapi.getResource

Explore with Pulumi AI

This resource can access any existing Azure resource manager resource.

Using getResource

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 getResource(args: GetResourceArgs, opts?: InvokeOptions): Promise<GetResourceResult>
function getResourceOutput(args: GetResourceOutputArgs, opts?: InvokeOptions): Output<GetResourceResult>
def get_resource(identity: Optional[GetResourceIdentity] = None,
                 name: Optional[str] = None,
                 parent_id: Optional[str] = None,
                 resource_id: Optional[str] = None,
                 response_export_values: Optional[Sequence[str]] = None,
                 type: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetResourceResult
def get_resource_output(identity: Optional[pulumi.Input[GetResourceIdentityArgs]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 parent_id: Optional[pulumi.Input[str]] = None,
                 resource_id: Optional[pulumi.Input[str]] = None,
                 response_export_values: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 type: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetResourceResult]
func LookupResource(ctx *Context, args *LookupResourceArgs, opts ...InvokeOption) (*LookupResourceResult, error)
func LookupResourceOutput(ctx *Context, args *LookupResourceOutputArgs, opts ...InvokeOption) LookupResourceResultOutput

> Note: This function is named LookupResource in the Go SDK.

public static class GetResource 
{
    public static Task<GetResourceResult> InvokeAsync(GetResourceArgs args, InvokeOptions? opts = null)
    public static Output<GetResourceResult> Invoke(GetResourceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetResourceResult> getResource(GetResourceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: azapi:index/getResource:getResource
  arguments:
    # arguments dictionary

The 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.

Identity ediri.Azapi.Inputs.GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

ResourceId string

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

ResponseExportValues List<string>

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}
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.

Identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

ResourceId string

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

ResponseExportValues []string

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}
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.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

resourceId String

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

responseExportValues List<String>

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}
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.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

resourceId string

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

responseExportValues string[]

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}
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.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

resource_id str

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

response_export_values Sequence[str]

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}
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.

identity Property Map

An identity block as defined below, which contains the Managed Service Identity information for 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_id should be the ID of a resource group, it's recommended to manage a resource group by azurerm_resource_group.
  • management group scope: parent_id should be the ID of a management group, it's recommended to manage a management group by azurerm_management_group.
  • extension scope: parent_id should be the ID of the resource you're adding the extension to.
  • subscription scope: parent_id should be like /subscriptions/00000000-0000-0000-0000-000000000000
  • tenant scope: parent_id should be /

For child level resources, the parent_id should be the ID of its parent resource, for example, subnet resource's parent_id is the ID of the vnet.

resourceId String

The ID of an existing azure source.

Note: Configuring name and parent_id is an alternative way to configure resource_id.

responseExportValues List<String>

A list of path that needs to be exported from response body. Setting it to ["*"] will export the full response body. Here's an example. If it sets to ["properties.loginServer", "properties.policies.quarantinePolicy.status"], it will set the following json to computed property output.

import * as pulumi from "@pulumi/pulumi";
import pulumi
using System.Collections.Generic;
using System.Linq;
using Pulumi;

return await Deployment.RunAsync(() => { });

package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
{}

getResource Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Identity ediri.Azapi.Outputs.GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

Location string

The Azure Region where the azure resource should exist.

Output string

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

Tags Dictionary<string, string>

A mapping of tags which should be assigned to the azure resource.

Type string

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

Name string
ParentId string
ResourceId string
ResponseExportValues List<string>
Id string

The provider-assigned unique ID for this managed resource.

Identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

Location string

The Azure Region where the azure resource should exist.

Output string

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

Tags map[string]string

A mapping of tags which should be assigned to the azure resource.

Type string

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

Name string
ParentId string
ResourceId string
ResponseExportValues []string
id String

The provider-assigned unique ID for this managed resource.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

location String

The Azure Region where the azure resource should exist.

output String

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

tags Map<String,String>

A mapping of tags which should be assigned to the azure resource.

type String

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

name String
parentId String
resourceId String
responseExportValues List<String>
id string

The provider-assigned unique ID for this managed resource.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

location string

The Azure Region where the azure resource should exist.

output string

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

tags {[key: string]: string}

A mapping of tags which should be assigned to the azure resource.

type string

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

name string
parentId string
resourceId string
responseExportValues string[]
id str

The provider-assigned unique ID for this managed resource.

identity GetResourceIdentity

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

location str

The Azure Region where the azure resource should exist.

output str

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

tags Mapping[str, str]

A mapping of tags which should be assigned to the azure resource.

type str

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

name str
parent_id str
resource_id str
response_export_values Sequence[str]
id String

The provider-assigned unique ID for this managed resource.

identity Property Map

An identity block as defined below, which contains the Managed Service Identity information for this azure resource.

location String

The Azure Region where the azure resource should exist.

output String

The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

tags Map<String>

A mapping of tags which should be assigned to the azure resource.

type String

The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.

name String
parentId String
resourceId String
responseExportValues List<String>

Supporting Types

GetResourceIdentity

IdentityIds List<string>

A list of User Managed Identity ID's which should be assigned to the azure resource.

PrincipalId string

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

TenantId string

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

IdentityIds []string

A list of User Managed Identity ID's which should be assigned to the azure resource.

PrincipalId string

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

TenantId string

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

identityIds List<String>

A list of User Managed Identity ID's which should be assigned to the azure resource.

principalId String

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

tenantId String

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

identityIds string[]

A list of User Managed Identity ID's which should be assigned to the azure resource.

principalId string

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

tenantId string

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

identity_ids Sequence[str]

A list of User Managed Identity ID's which should be assigned to the azure resource.

principal_id str

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

tenant_id str

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

identityIds List<String>

A list of User Managed Identity ID's which should be assigned to the azure resource.

principalId String

The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.

tenantId String

The Tenant ID for the Service Principal associated with the Managed Service Identity of this azure resource.

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.

Package Details

Repository
azapi dirien/pulumi-azapi
License
Apache-2.0
Notes

This Pulumi package is based on the azapi Terraform Provider.