azapi.Resource
Explore with Pulumi AI
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.
Constructor 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={
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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. Resource Identity - A
identity
block as defined below. - Ignore
Body List<string>Changes - 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 tofalse
. - Ignore
Missing boolProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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.
- Parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- Removing
Special boolChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- Schema
Validation boolEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity Args - A
identity
block as defined below. - Ignore
Body []stringChanges - 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 tofalse
. - Ignore
Missing boolProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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.
- Parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- Removing
Special boolChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- Schema
Validation boolEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity - A
identity
block as defined below. - ignore
Body List<String>Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing Boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing BooleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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.
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special BooleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation BooleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity - A
identity
block as defined below. - ignore
Body string[]Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing booleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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.
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special booleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation booleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - {[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
Resource
Identity Args - A
identity
block as defined below. - ignore_
body_ Sequence[str]changes - 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 tofalse
. - ignore_
missing_ boolproperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing_
special_ boolchars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema_
validation_ boolenabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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. - ignore
Body List<String>Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing Boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing BooleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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.
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special BooleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation BooleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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.
- Body string
- A JSON object that contains the request body used to create and update azure resource.
- Identity
ediri.
Azapi. Inputs. Resource Identity - A
identity
block as defined below. - Ignore
Body List<string>Changes - 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 tofalse
. - Ignore
Missing boolProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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 }
- Parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- Removing
Special boolChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- Schema
Validation boolEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity Args - A
identity
block as defined below. - Ignore
Body []stringChanges - 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 tofalse
. - Ignore
Missing boolProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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 }
- Parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- Removing
Special boolChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- Schema
Validation boolEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity - A
identity
block as defined below. - ignore
Body List<String>Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing Boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing BooleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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 }
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special BooleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation BooleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
Resource
Identity - A
identity
block as defined below. - ignore
Body string[]Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing booleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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 }
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special booleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation booleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - {[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
Resource
Identity Args - A
identity
block as defined below. - ignore_
body_ Sequence[str]changes - 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 tofalse
. - ignore_
missing_ boolproperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing_
special_ boolchars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema_
validation_ boolenabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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. - ignore
Body List<String>Changes - A list of properties that should be ignored when comparing the
body
with its current state. - ignore
Casing Boolean - Whether ignore incorrect casing returned in
body
to suppress plan-diff. Defaults tofalse
. - ignore
Missing BooleanProperty - Whether ignore not returned properties like credentials in
body
to suppress plan-diff. Defaults totrue
. - 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 }
- parent
Id 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'sparent_id
is the ID of the vnet.For type
Microsoft.Resources/resourceGroups
, theparent_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
).- resource group scope:
- removing
Special BooleanChars - Whether to remove special characters in resource name. Defaults to
false
. - 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
.{ "properties" : { "loginServer" : "registry1.azurecr.io" "policies" : { "quarantinePolicy" = { "status" = "disabled" } } } }
- schema
Validation BooleanEnabled - Whether enabled the validation on
type
andbody
with embedded schema. Defaults totrue
. - 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
andSystemAssigned,UserAssigned
. - 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
- The Type of Identity which should be used for this azure resource. Possible values are
SystemAssigned
,UserAssigned
andSystemAssigned,UserAssigned
. - 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
- The Type of Identity which should be used for this azure resource. Possible values are
SystemAssigned
,UserAssigned
andSystemAssigned,UserAssigned
. - 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
- The Type of Identity which should be used for this azure resource. Possible values are
SystemAssigned
,UserAssigned
andSystemAssigned,UserAssigned
. - 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 str
- The Type of Identity which should be used for this azure resource. Possible values are
SystemAssigned
,UserAssigned
andSystemAssigned,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
andSystemAssigned,UserAssigned
. - 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.
Import
Azure resource can be imported using the resource id
, e.g.
$ pulumi import azapi:index/resource:Resource example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1
It also supports specifying API version by using the resource id
with api-version
as a query parameter, e.g.
$ 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
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.