1. Packages
  2. Azure Classic
  3. API Docs
  4. advisor
  5. Suppression

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.advisor.Suppression

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Specifies a suppression for an Azure Advisor recommendation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const current = azure.core.getClientConfig({});
    const example = azure.advisor.getRecommendations({});
    const exampleSuppression = new azure.advisor.Suppression("example", {
        name: "HardcodedSuppressionName",
        recommendationId: test.recommendations[0].recommendationName,
        resourceId: current.then(current => `/subscriptions/${current.subscriptionId}`),
        ttl: "01:00:00:00",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    current = azure.core.get_client_config()
    example = azure.advisor.get_recommendations()
    example_suppression = azure.advisor.Suppression("example",
        name="HardcodedSuppressionName",
        recommendation_id=test["recommendations"][0]["recommendationName"],
        resource_id=f"/subscriptions/{current.subscription_id}",
        ttl="01:00:00:00")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/advisor"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = advisor.GetRecommendations(ctx, &advisor.GetRecommendationsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = advisor.NewSuppression(ctx, "example", &advisor.SuppressionArgs{
    			Name:             pulumi.String("HardcodedSuppressionName"),
    			RecommendationId: pulumi.Any(test.Recommendations[0].RecommendationName),
    			ResourceId:       pulumi.Sprintf("/subscriptions/%v", current.SubscriptionId),
    			Ttl:              pulumi.String("01:00:00:00"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Azure.Core.GetClientConfig.Invoke();
    
        var example = Azure.Advisor.GetRecommendations.Invoke();
    
        var exampleSuppression = new Azure.Advisor.Suppression("example", new()
        {
            Name = "HardcodedSuppressionName",
            RecommendationId = test.Recommendations[0].RecommendationName,
            ResourceId = $"/subscriptions/{current.Apply(getClientConfigResult => getClientConfigResult.SubscriptionId)}",
            Ttl = "01:00:00:00",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.CoreFunctions;
    import com.pulumi.azure.advisor.AdvisorFunctions;
    import com.pulumi.azure.advisor.inputs.GetRecommendationsArgs;
    import com.pulumi.azure.advisor.Suppression;
    import com.pulumi.azure.advisor.SuppressionArgs;
    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) {
            final var current = CoreFunctions.getClientConfig();
    
            final var example = AdvisorFunctions.getRecommendations();
    
            var exampleSuppression = new Suppression("exampleSuppression", SuppressionArgs.builder()
                .name("HardcodedSuppressionName")
                .recommendationId(test.recommendations()[0].recommendationName())
                .resourceId(String.format("/subscriptions/%s", current.applyValue(getClientConfigResult -> getClientConfigResult.subscriptionId())))
                .ttl("01:00:00:00")
                .build());
    
        }
    }
    
    resources:
      exampleSuppression:
        type: azure:advisor:Suppression
        name: example
        properties:
          name: HardcodedSuppressionName
          recommendationId: ${test.recommendations[0].recommendationName}
          resourceId: /subscriptions/${current.subscriptionId}
          ttl: 01:00:00:00
    variables:
      current:
        fn::invoke:
          Function: azure:core:getClientConfig
          Arguments: {}
      example:
        fn::invoke:
          Function: azure:advisor:getRecommendations
          Arguments: {}
    

    Create Suppression Resource

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

    Constructor syntax

    new Suppression(name: string, args: SuppressionArgs, opts?: CustomResourceOptions);
    @overload
    def Suppression(resource_name: str,
                    args: SuppressionArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def Suppression(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    recommendation_id: Optional[str] = None,
                    resource_id: Optional[str] = None,
                    name: Optional[str] = None,
                    ttl: Optional[str] = None)
    func NewSuppression(ctx *Context, name string, args SuppressionArgs, opts ...ResourceOption) (*Suppression, error)
    public Suppression(string name, SuppressionArgs args, CustomResourceOptions? opts = null)
    public Suppression(String name, SuppressionArgs args)
    public Suppression(String name, SuppressionArgs args, CustomResourceOptions options)
    
    type: azure:advisor:Suppression
    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 SuppressionArgs
    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 SuppressionArgs
    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 SuppressionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SuppressionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SuppressionArgs
    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 suppressionResource = new Azure.Advisor.Suppression("suppressionResource", new()
    {
        RecommendationId = "string",
        ResourceId = "string",
        Name = "string",
        Ttl = "string",
    });
    
    example, err := advisor.NewSuppression(ctx, "suppressionResource", &advisor.SuppressionArgs{
    	RecommendationId: pulumi.String("string"),
    	ResourceId:       pulumi.String("string"),
    	Name:             pulumi.String("string"),
    	Ttl:              pulumi.String("string"),
    })
    
    var suppressionResource = new Suppression("suppressionResource", SuppressionArgs.builder()
        .recommendationId("string")
        .resourceId("string")
        .name("string")
        .ttl("string")
        .build());
    
    suppression_resource = azure.advisor.Suppression("suppressionResource",
        recommendation_id="string",
        resource_id="string",
        name="string",
        ttl="string")
    
    const suppressionResource = new azure.advisor.Suppression("suppressionResource", {
        recommendationId: "string",
        resourceId: "string",
        name: "string",
        ttl: "string",
    });
    
    type: azure:advisor:Suppression
    properties:
        name: string
        recommendationId: string
        resourceId: string
        ttl: string
    

    Suppression 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 Suppression resource accepts the following input properties:

    RecommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    ResourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    Name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    Ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    RecommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    ResourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    Name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    Ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    recommendationId String
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId String
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    name String
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    ttl String
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    recommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    recommendation_id str
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resource_id str
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    name str
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    ttl str
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    recommendationId String
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId String
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    name String
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    ttl String
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    SuppressionId string
    The GUID of the suppression.
    Id string
    The provider-assigned unique ID for this managed resource.
    SuppressionId string
    The GUID of the suppression.
    id String
    The provider-assigned unique ID for this managed resource.
    suppressionId String
    The GUID of the suppression.
    id string
    The provider-assigned unique ID for this managed resource.
    suppressionId string
    The GUID of the suppression.
    id str
    The provider-assigned unique ID for this managed resource.
    suppression_id str
    The GUID of the suppression.
    id String
    The provider-assigned unique ID for this managed resource.
    suppressionId String
    The GUID of the suppression.

    Look up Existing Suppression Resource

    Get an existing Suppression 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?: SuppressionState, opts?: CustomResourceOptions): Suppression
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            recommendation_id: Optional[str] = None,
            resource_id: Optional[str] = None,
            suppression_id: Optional[str] = None,
            ttl: Optional[str] = None) -> Suppression
    func GetSuppression(ctx *Context, name string, id IDInput, state *SuppressionState, opts ...ResourceOption) (*Suppression, error)
    public static Suppression Get(string name, Input<string> id, SuppressionState? state, CustomResourceOptions? opts = null)
    public static Suppression get(String name, Output<String> id, SuppressionState 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:
    Name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    RecommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    ResourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    SuppressionId string
    The GUID of the suppression.
    Ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    Name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    RecommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    ResourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    SuppressionId string
    The GUID of the suppression.
    Ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    name String
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    recommendationId String
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId String
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    suppressionId String
    The GUID of the suppression.
    ttl String
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    name string
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    recommendationId string
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId string
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    suppressionId string
    The GUID of the suppression.
    ttl string
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    name str
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    recommendation_id str
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resource_id str
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    suppression_id str
    The GUID of the suppression.
    ttl str
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
    name String
    The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
    recommendationId String
    The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
    resourceId String
    The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
    suppressionId String
    The GUID of the suppression.
    ttl String
    A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.

    Import

    Advisor suppressions can be imported using the resource id, e.g.

    $ pulumi import azure:advisor/suppression:Suppression example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/00000000-0000-0000-0000-000000000000/suppressions/name
    

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi