1. Packages
  2. AzAPI
  3. API Docs
  4. Resource
AzAPI v1.12.1 published on Sunday, Mar 3, 2024 by dirien

azapi.Resource

Explore with Pulumi AI

azapi logo
AzAPI v1.12.1 published on Sunday, Mar 3, 2024 by dirien

    This resource can manage any Azure resource manager resource.

    Example Usage

    terraform {
      required_providers {
        azapi = {
          source = "Azure/azapi"
        }
      }
    }
    
    provider "azapi" {
    }
    
    provider "azurerm" {
      features {}
    }
    
    resource "azurerm_resource_group" "example" {
      name     = "example-rg"
      location = "west europe"
    }
    
    resource "azurerm_user_assigned_identity" "example" {
      name                = "example"
      resource_group_name = azurerm_resource_group.example.name
      location            = azurerm_resource_group.example.location
    }
    
    // manage a container registry resource
    resource "azapi_resource" "example" {
      type      = "Microsoft.ContainerRegistry/registries@2020-11-01-preview"
      name      = "registry1"
      parent_id = azurerm_resource_group.example.id
    
      location = azurerm_resource_group.example.location
      identity {
        type         = "SystemAssigned, UserAssigned"
        identity_ids = [azurerm_user_assigned_identity.example.id]
      }
    
      body = jsonencode({
        sku = {
          name = "Standard"
        }
        properties = {
          adminUserEnabled = true
        }
      })
    
      tags = {
        "Key" = "Value"
      }
    
      response_export_values = ["properties.loginServer", "properties.policies.quarantinePolicy.status"]
    }
    
    // it will output "registry1.azurecr.io"
    output "login_server" {
      value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    // it will output "disabled"
    output "quarantine_policy" {
      value = jsondecode(azapi_resource.example.output).properties.policies.quarantinePolicy.status
    }
    

    Create Resource Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Resource(name: string, args: ResourceArgs, opts?: CustomResourceOptions);
    @overload
    def Resource(resource_name: str,
                 args: ResourceArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Resource(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 type: Optional[str] = None,
                 locks: Optional[Sequence[str]] = None,
                 ignore_body_changes: Optional[Sequence[str]] = None,
                 ignore_casing: Optional[bool] = None,
                 ignore_missing_property: Optional[bool] = None,
                 location: Optional[str] = None,
                 body: Optional[str] = None,
                 name: Optional[str] = None,
                 parent_id: Optional[str] = None,
                 removing_special_chars: Optional[bool] = None,
                 response_export_values: Optional[Sequence[str]] = None,
                 schema_validation_enabled: Optional[bool] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 identity: Optional[ResourceIdentityArgs] = None)
    func NewResource(ctx *Context, name string, args ResourceArgs, opts ...ResourceOption) (*Resource, error)
    public Resource(string name, ResourceArgs args, CustomResourceOptions? opts = null)
    public Resource(String name, ResourceArgs args)
    public Resource(String name, ResourceArgs args, CustomResourceOptions options)
    
    type: azapi:Resource
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ResourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ResourceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ResourceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var resourceResource = new Azapi.Resource("resourceResource", new()
    {
        Type = "string",
        Locks = new[]
        {
            "string",
        },
        IgnoreBodyChanges = new[]
        {
            "string",
        },
        IgnoreCasing = false,
        IgnoreMissingProperty = false,
        Location = "string",
        Body = "string",
        Name = "string",
        ParentId = "string",
        ResponseExportValues = new[]
        {
            "string",
        },
        SchemaValidationEnabled = false,
        Tags = 
        {
            { "string", "string" },
        },
        Identity = new Azapi.Inputs.ResourceIdentityArgs
        {
            Type = "string",
            IdentityIds = new[]
            {
                "string",
            },
            PrincipalId = "string",
            TenantId = "string",
        },
    });
    
    example, err := azapi.NewResource(ctx, "resourceResource", &azapi.ResourceArgs{
    	Type: pulumi.String("string"),
    	Locks: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	IgnoreBodyChanges: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	IgnoreCasing:          pulumi.Bool(false),
    	IgnoreMissingProperty: pulumi.Bool(false),
    	Location:              pulumi.String("string"),
    	Body:                  pulumi.String("string"),
    	Name:                  pulumi.String("string"),
    	ParentId:              pulumi.String("string"),
    	ResponseExportValues: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	SchemaValidationEnabled: pulumi.Bool(false),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Identity: &azapi.ResourceIdentityArgs{
    		Type: pulumi.String("string"),
    		IdentityIds: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		PrincipalId: pulumi.String("string"),
    		TenantId:    pulumi.String("string"),
    	},
    })
    
    var resourceResource = new Resource("resourceResource", ResourceArgs.builder()        
        .type("string")
        .locks("string")
        .ignoreBodyChanges("string")
        .ignoreCasing(false)
        .ignoreMissingProperty(false)
        .location("string")
        .body("string")
        .name("string")
        .parentId("string")
        .responseExportValues("string")
        .schemaValidationEnabled(false)
        .tags(Map.of("string", "string"))
        .identity(ResourceIdentityArgs.builder()
            .type("string")
            .identityIds("string")
            .principalId("string")
            .tenantId("string")
            .build())
        .build());
    
    resource_resource = azapi.Resource("resourceResource",
        type="string",
        locks=["string"],
        ignore_body_changes=["string"],
        ignore_casing=False,
        ignore_missing_property=False,
        location="string",
        body="string",
        name="string",
        parent_id="string",
        response_export_values=["string"],
        schema_validation_enabled=False,
        tags={
            "string": "string",
        },
        identity=azapi.ResourceIdentityArgs(
            type="string",
            identity_ids=["string"],
            principal_id="string",
            tenant_id="string",
        ))
    
    const resourceResource = new azapi.Resource("resourceResource", {
        type: "string",
        locks: ["string"],
        ignoreBodyChanges: ["string"],
        ignoreCasing: false,
        ignoreMissingProperty: false,
        location: "string",
        body: "string",
        name: "string",
        parentId: "string",
        responseExportValues: ["string"],
        schemaValidationEnabled: false,
        tags: {
            string: "string",
        },
        identity: {
            type: "string",
            identityIds: ["string"],
            principalId: "string",
            tenantId: "string",
        },
    });
    
    type: azapi:Resource
    properties:
        body: string
        identity:
            identityIds:
                - string
            principalId: string
            tenantId: string
            type: string
        ignoreBodyChanges:
            - string
        ignoreCasing: false
        ignoreMissingProperty: false
        location: string
        locks:
            - string
        name: string
        parentId: string
        responseExportValues:
            - string
        schemaValidationEnabled: false
        tags:
            string: string
        type: string
    

    Resource Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Resource resource accepts the following input properties:

    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.
    Body string
    A JSON object that contains the request body used to create and update azure resource.
    Identity ediri.Azapi.Inputs.ResourceIdentity
    A identity block as defined below.
    IgnoreBodyChanges List<string>
    A list of properties that should be ignored when comparing the body with its current state.
    IgnoreCasing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    IgnoreMissingProperty bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    Location string
    The Azure Region where the azure resource should exist.
    Locks List<string>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    Name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    ParentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    RemovingSpecialChars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    SchemaValidationEnabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the 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.
    Body string
    A JSON object that contains the request body used to create and update azure resource.
    Identity ResourceIdentityArgs
    A identity block as defined below.
    IgnoreBodyChanges []string
    A list of properties that should be ignored when comparing the body with its current state.
    IgnoreCasing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    IgnoreMissingProperty bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    Location string
    The Azure Region where the azure resource should exist.
    Locks []string
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    Name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    ParentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    RemovingSpecialChars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    SchemaValidationEnabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    Tags map[string]string
    A mapping of tags which should be assigned to the 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.
    body String
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentity
    A identity block as defined below.
    ignoreBodyChanges List<String>
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing Boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty Boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location String
    The Azure Region where the azure resource should exist.
    locks List<String>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name String
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    parentId String

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars Boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled Boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Map<String,String>
    A mapping of tags which should be assigned to the 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.
    body string
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentity
    A identity block as defined below.
    ignoreBodyChanges string[]
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location string
    The Azure Region where the azure resource should exist.
    locks string[]
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    parentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the 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.
    body str
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentityArgs
    A identity block as defined below.
    ignore_body_changes Sequence[str]
    A list of properties that should be ignored when comparing the body with its current state.
    ignore_casing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignore_missing_property bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location str
    The Azure Region where the azure resource should exist.
    locks Sequence[str]
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name str
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    parent_id str

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removing_special_chars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schema_validation_enabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the 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.
    body String
    A JSON object that contains the request body used to create and update azure resource.
    identity Property Map
    A identity block as defined below.
    ignoreBodyChanges List<String>
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing Boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty Boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location String
    The Azure Region where the azure resource should exist.
    locks List<String>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name String
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    parentId String

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars Boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled Boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Map<String>
    A mapping of tags which should be assigned to the azure resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Resource resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    Id string
    The provider-assigned unique ID for this managed resource.
    Output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    id String
    The provider-assigned unique ID for this managed resource.
    output String
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    id string
    The provider-assigned unique ID for this managed resource.
    output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    id str
    The provider-assigned unique ID for this managed resource.
    output str
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    id String
    The provider-assigned unique ID for this managed resource.
    output String
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    

    Look up Existing Resource Resource

    Get an existing Resource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ResourceState, opts?: CustomResourceOptions): Resource
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            body: Optional[str] = None,
            identity: Optional[ResourceIdentityArgs] = None,
            ignore_body_changes: Optional[Sequence[str]] = None,
            ignore_casing: Optional[bool] = None,
            ignore_missing_property: Optional[bool] = None,
            location: Optional[str] = None,
            locks: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            output: Optional[str] = None,
            parent_id: Optional[str] = None,
            removing_special_chars: Optional[bool] = None,
            response_export_values: Optional[Sequence[str]] = None,
            schema_validation_enabled: Optional[bool] = None,
            tags: Optional[Mapping[str, str]] = None,
            type: Optional[str] = None) -> Resource
    func GetResource(ctx *Context, name string, id IDInput, state *ResourceState, opts ...ResourceOption) (*Resource, error)
    public static Resource Get(string name, Input<string> id, ResourceState? state, CustomResourceOptions? opts = null)
    public static Resource get(String name, Output<String> id, ResourceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Body string
    A JSON object that contains the request body used to create and update azure resource.
    Identity ediri.Azapi.Inputs.ResourceIdentity
    A identity block as defined below.
    IgnoreBodyChanges List<string>
    A list of properties that should be ignored when comparing the body with its current state.
    IgnoreCasing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    IgnoreMissingProperty bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    Location string
    The Azure Region where the azure resource should exist.
    Locks List<string>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    Name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    Output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    ParentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    RemovingSpecialChars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    SchemaValidationEnabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the 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.
    Body string
    A JSON object that contains the request body used to create and update azure resource.
    Identity ResourceIdentityArgs
    A identity block as defined below.
    IgnoreBodyChanges []string
    A list of properties that should be ignored when comparing the body with its current state.
    IgnoreCasing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    IgnoreMissingProperty bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    Location string
    The Azure Region where the azure resource should exist.
    Locks []string
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    Name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    Output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    ParentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    RemovingSpecialChars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    SchemaValidationEnabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    Tags map[string]string
    A mapping of tags which should be assigned to the 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.
    body String
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentity
    A identity block as defined below.
    ignoreBodyChanges List<String>
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing Boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty Boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location String
    The Azure Region where the azure resource should exist.
    locks List<String>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name String
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    output String
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    parentId String

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars Boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled Boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Map<String,String>
    A mapping of tags which should be assigned to the 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.
    body string
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentity
    A identity block as defined below.
    ignoreBodyChanges string[]
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location string
    The Azure Region where the azure resource should exist.
    locks string[]
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name string
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    output string
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    parentId string

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the 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.
    body str
    A JSON object that contains the request body used to create and update azure resource.
    identity ResourceIdentityArgs
    A identity block as defined below.
    ignore_body_changes Sequence[str]
    A list of properties that should be ignored when comparing the body with its current state.
    ignore_casing bool
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignore_missing_property bool
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location str
    The Azure Region where the azure resource should exist.
    locks Sequence[str]
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name str
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    output str
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    parent_id str

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removing_special_chars bool
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schema_validation_enabled bool
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the 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.
    body String
    A JSON object that contains the request body used to create and update azure resource.
    identity Property Map
    A identity block as defined below.
    ignoreBodyChanges List<String>
    A list of properties that should be ignored when comparing the body with its current state.
    ignoreCasing Boolean
    Whether ignore incorrect casing returned in body to suppress plan-diff. Defaults to false.
    ignoreMissingProperty Boolean
    Whether ignore not returned properties like credentials in body to suppress plan-diff. Defaults to true.
    location String
    The Azure Region where the azure resource should exist.
    locks List<String>
    A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.
    name String
    Specifies the name of the azure resource. Changing this forces a new resource to be created.
    output String
    The output json containing the properties specified in response_export_values. Here're some examples to decode json and extract the value.

    // it will output "registry1.azurecr.io"
    output "login_server" {
    value = jsondecode(azapi_resource.example.output).properties.loginServer
    }
    
    parentId String

    The ID of the azure resource in which this resource is created. Changing this forces a new resource to be 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.

    For type Microsoft.Resources/resourceGroups, the parent_id could be omitted, it defaults to subscription ID specified in provider or the default subscription(You could check the default subscription by azure cli command: az account show).

    removingSpecialChars Boolean
    Whether to remove special characters in resource name. Defaults to false.

    Deprecated: It will not work in the next minor release and will be removed in the next major release. Please specify the name field and remove the special characters in the name field instead.

    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.

    {
    "properties" : {
    "loginServer" : "registry1.azurecr.io"
    "policies" : {
    "quarantinePolicy" = {
    "status" = "disabled"
    }
    }
    }
    }
    
    schemaValidationEnabled Boolean
    Whether enabled the validation on type and body with embedded schema. Defaults to true.
    tags Map<String>
    A mapping of tags which should be assigned to the 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.

    Supporting Types

    ResourceIdentity, ResourceIdentityArgs

    Type string
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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 str
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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 String
    The Type of Identity which should be used for this azure resource. Possible values are SystemAssigned, UserAssigned and SystemAssigned,UserAssigned.
    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.

    Import

    Azure resource can be imported using the resource id, e.g. sh<break> $ pulumi import azapi:index/resource:Resource example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1 <break> It also supports specifying API version by using the resource id with api-version as a query parameter, e.g. sh<break> $ pulumi import azapi:index/resource:Resource example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1?api-version=2021-07-01 <break>

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    azapi dirien/pulumi-azapi
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azapi Terraform Provider.
    azapi logo
    AzAPI v1.12.1 published on Sunday, Mar 3, 2024 by dirien