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. Get Resource Identity 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.
- Parent
Id 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'sparent_id
is the ID of the vnet.- resource group scope:
- Resource
Id string The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- Response
Export List<string>Values 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 propertyoutput
.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
Get
Resource Identity 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.
- Parent
Id 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'sparent_id
is the ID of the vnet.- resource group scope:
- Resource
Id string The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- Response
Export []stringValues 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 propertyoutput
.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
Get
Resource Identity 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.
- parent
Id 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'sparent_id
is the ID of the vnet.- resource group scope:
- resource
Id String The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- response
Export List<String>Values 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 propertyoutput
.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
Get
Resource Identity 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.
- parent
Id 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'sparent_id
is the ID of the vnet.- resource group scope:
- resource
Id string The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- response
Export string[]Values 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 propertyoutput
.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
Get
Resource Identity 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'sparent_id
is the ID of the vnet.- resource group scope:
- resource_
id str The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- response_
export_ Sequence[str]values 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 propertyoutput
.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.
- parent
Id 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'sparent_id
is the ID of the vnet.- resource group scope:
- resource
Id String The ID of an existing azure source.
Note: Configuring
name
andparent_id
is an alternative way to configureresource_id
.- response
Export List<String>Values 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 propertyoutput
.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. Get Resource Identity 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.- 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
andSystemAssigned,UserAssigned
.- Name string
- Parent
Id string - Resource
Id string - Response
Export List<string>Values
- Id string
The provider-assigned unique ID for this managed resource.
- Identity
Get
Resource Identity 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.- 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
andSystemAssigned,UserAssigned
.- Name string
- Parent
Id string - Resource
Id string - Response
Export []stringValues
- id String
The provider-assigned unique ID for this managed resource.
- identity
Get
Resource Identity 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.- 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
andSystemAssigned,UserAssigned
.- name String
- parent
Id String - resource
Id String - response
Export List<String>Values
- id string
The provider-assigned unique ID for this managed resource.
- identity
Get
Resource Identity 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.- {[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
andSystemAssigned,UserAssigned
.- name string
- parent
Id string - resource
Id string - response
Export string[]Values
- id str
The provider-assigned unique ID for this managed resource.
- identity
Get
Resource Identity 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.- 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
andSystemAssigned,UserAssigned
.- name str
- parent_
id str - resource_
id str - response_
export_ Sequence[str]values
- 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.- 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
andSystemAssigned,UserAssigned
.- name String
- parent
Id String - resource
Id String - response
Export List<String>Values
Supporting Types
GetResourceIdentity
- Identity
Ids List<string> A list of User Managed Identity ID's which should be assigned to the azure resource.
- Principal
Id string The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.
- Tenant
Id 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 []string A list of User Managed Identity ID's which should be assigned to the azure resource.
- Principal
Id string The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.
- Tenant
Id 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 List<String> A list of User Managed Identity ID's which should be assigned to the azure resource.
- principal
Id String The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.
- tenant
Id 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 string[] A list of User Managed Identity ID's which should be assigned to the azure resource.
- principal
Id string The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.
- tenant
Id 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.
- identity
Ids List<String> A list of User Managed Identity ID's which should be assigned to the azure resource.
- principal
Id String The Principal ID for the Service Principal associated with the Managed Service Identity of this azure resource.
- tenant
Id 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.