We recommend using Azure Native.
azure.apimanagement.ApiTag
Explore with Pulumi AI
Manages the Assignment of an API Management API Tag to an API.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var exampleService = Azure.ApiManagement.GetService.Invoke(new()
{
Name = "example-apim",
ResourceGroupName = exampleResourceGroup.Name,
});
var exampleApi = new Azure.ApiManagement.Api("exampleApi", new()
{
ResourceGroupName = exampleResourceGroup.Name,
ApiManagementName = exampleService.Apply(getServiceResult => getServiceResult.Name),
Revision = "1",
});
var exampleTag = new Azure.ApiManagement.Tag("exampleTag", new()
{
ApiManagementId = exampleService.Apply(getServiceResult => getServiceResult.Id),
});
var exampleApiTag = new Azure.ApiManagement.ApiTag("exampleApiTag", new()
{
ApiId = exampleApi.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleService := apimanagement.LookupServiceOutput(ctx, apimanagement.GetServiceOutputArgs{
Name: pulumi.String("example-apim"),
ResourceGroupName: exampleResourceGroup.Name,
}, nil)
exampleApi, err := apimanagement.NewApi(ctx, "exampleApi", &apimanagement.ApiArgs{
ResourceGroupName: exampleResourceGroup.Name,
ApiManagementName: exampleService.ApplyT(func(exampleService apimanagement.GetServiceResult) (*string, error) {
return &exampleService.Name, nil
}).(pulumi.StringPtrOutput),
Revision: pulumi.String("1"),
})
if err != nil {
return err
}
_, err = apimanagement.NewTag(ctx, "exampleTag", &apimanagement.TagArgs{
ApiManagementId: exampleService.ApplyT(func(exampleService apimanagement.GetServiceResult) (*string, error) {
return &exampleService.Id, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
_, err = apimanagement.NewApiTag(ctx, "exampleApiTag", &apimanagement.ApiTagArgs{
ApiId: exampleApi.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.apimanagement.ApimanagementFunctions;
import com.pulumi.azure.apimanagement.inputs.GetServiceArgs;
import com.pulumi.azure.apimanagement.Api;
import com.pulumi.azure.apimanagement.ApiArgs;
import com.pulumi.azure.apimanagement.Tag;
import com.pulumi.azure.apimanagement.TagArgs;
import com.pulumi.azure.apimanagement.ApiTag;
import com.pulumi.azure.apimanagement.ApiTagArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
final var exampleService = ApimanagementFunctions.getService(GetServiceArgs.builder()
.name("example-apim")
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleApi = new Api("exampleApi", ApiArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult).applyValue(exampleService -> exampleService.applyValue(getServiceResult -> getServiceResult.name())))
.revision("1")
.build());
var exampleTag = new Tag("exampleTag", TagArgs.builder()
.apiManagementId(exampleService.applyValue(getServiceResult -> getServiceResult).applyValue(exampleService -> exampleService.applyValue(getServiceResult -> getServiceResult.id())))
.build());
var exampleApiTag = new ApiTag("exampleApiTag", ApiTagArgs.builder()
.apiId(exampleApi.id())
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_service = azure.apimanagement.get_service_output(name="example-apim",
resource_group_name=example_resource_group.name)
example_api = azure.apimanagement.Api("exampleApi",
resource_group_name=example_resource_group.name,
api_management_name=example_service.name,
revision="1")
example_tag = azure.apimanagement.Tag("exampleTag", api_management_id=example_service.id)
example_api_tag = azure.apimanagement.ApiTag("exampleApiTag", api_id=example_api.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleService = azure.apimanagement.getServiceOutput({
name: "example-apim",
resourceGroupName: exampleResourceGroup.name,
});
const exampleApi = new azure.apimanagement.Api("exampleApi", {
resourceGroupName: exampleResourceGroup.name,
apiManagementName: exampleService.apply(exampleService => exampleService.name),
revision: "1",
});
const exampleTag = new azure.apimanagement.Tag("exampleTag", {apiManagementId: exampleService.apply(exampleService => exampleService.id)});
const exampleApiTag = new azure.apimanagement.ApiTag("exampleApiTag", {apiId: exampleApi.id});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleApi:
type: azure:apimanagement:Api
properties:
resourceGroupName: ${exampleResourceGroup.name}
apiManagementName: ${exampleService.name}
revision: '1'
exampleTag:
type: azure:apimanagement:Tag
properties:
apiManagementId: ${exampleService.id}
exampleApiTag:
type: azure:apimanagement:ApiTag
properties:
apiId: ${exampleApi.id}
variables:
exampleService:
fn::invoke:
Function: azure:apimanagement:getService
Arguments:
name: example-apim
resourceGroupName: ${exampleResourceGroup.name}
Create ApiTag Resource
new ApiTag(name: string, args: ApiTagArgs, opts?: CustomResourceOptions);
@overload
def ApiTag(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
name: Optional[str] = None)
@overload
def ApiTag(resource_name: str,
args: ApiTagArgs,
opts: Optional[ResourceOptions] = None)
func NewApiTag(ctx *Context, name string, args ApiTagArgs, opts ...ResourceOption) (*ApiTag, error)
public ApiTag(string name, ApiTagArgs args, CustomResourceOptions? opts = null)
public ApiTag(String name, ApiTagArgs args)
public ApiTag(String name, ApiTagArgs args, CustomResourceOptions options)
type: azure:apimanagement:ApiTag
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiTagArgs
- 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 ApiTagArgs
- 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 ApiTagArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiTagArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiTagArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ApiTag 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 ApiTag resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiTag resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing ApiTag Resource
Get an existing ApiTag 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?: ApiTagState, opts?: CustomResourceOptions): ApiTag
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
name: Optional[str] = None) -> ApiTag
func GetApiTag(ctx *Context, name string, id IDInput, state *ApiTagState, opts ...ResourceOption) (*ApiTag, error)
public static ApiTag Get(string name, Input<string> id, ApiTagState? state, CustomResourceOptions? opts = null)
public static ApiTag get(String name, Output<String> id, ApiTagState 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.
Import
API Management API Tags can be imported using the resource id
, e.g.
$ pulumi import azure:apimanagement/apiTag:ApiTag example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/api1/tags/tag1
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.