newrelic logo
New Relic v5.12.0, May 30 23

newrelic.ObfuscationRule

Explore with Pulumi AI

Use this resource to create, update and delete New Relic Obfuscation Rule.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var bar = new NewRelic.ObfuscationExpression("bar", new()
    {
        Description = "description of the expression",
        Regex = "(^http)",
    });

    var foo = new NewRelic.ObfuscationRule("foo", new()
    {
        Description = "description of the rule",
        Filter = "hostStatus=running",
        Enabled = true,
        Actions = new[]
        {
            new NewRelic.Inputs.ObfuscationRuleActionArgs
            {
                Attributes = new[]
                {
                    "message",
                },
                ExpressionId = bar.Id,
                Method = "MASK",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bar, err := newrelic.NewObfuscationExpression(ctx, "bar", &newrelic.ObfuscationExpressionArgs{
			Description: pulumi.String("description of the expression"),
			Regex:       pulumi.String("(^http)"),
		})
		if err != nil {
			return err
		}
		_, err = newrelic.NewObfuscationRule(ctx, "foo", &newrelic.ObfuscationRuleArgs{
			Description: pulumi.String("description of the rule"),
			Filter:      pulumi.String("hostStatus=running"),
			Enabled:     pulumi.Bool(true),
			Actions: newrelic.ObfuscationRuleActionArray{
				&newrelic.ObfuscationRuleActionArgs{
					Attributes: pulumi.StringArray{
						pulumi.String("message"),
					},
					ExpressionId: bar.ID(),
					Method:       pulumi.String("MASK"),
				},
			},
		})
		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.newrelic.ObfuscationExpression;
import com.pulumi.newrelic.ObfuscationExpressionArgs;
import com.pulumi.newrelic.ObfuscationRule;
import com.pulumi.newrelic.ObfuscationRuleArgs;
import com.pulumi.newrelic.inputs.ObfuscationRuleActionArgs;
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 bar = new ObfuscationExpression("bar", ObfuscationExpressionArgs.builder()        
            .description("description of the expression")
            .regex("(^http)")
            .build());

        var foo = new ObfuscationRule("foo", ObfuscationRuleArgs.builder()        
            .description("description of the rule")
            .filter("hostStatus=running")
            .enabled(true)
            .actions(ObfuscationRuleActionArgs.builder()
                .attributes("message")
                .expressionId(bar.id())
                .method("MASK")
                .build())
            .build());

    }
}
import pulumi
import pulumi_newrelic as newrelic

bar = newrelic.ObfuscationExpression("bar",
    description="description of the expression",
    regex="(^http)")
foo = newrelic.ObfuscationRule("foo",
    description="description of the rule",
    filter="hostStatus=running",
    enabled=True,
    actions=[newrelic.ObfuscationRuleActionArgs(
        attributes=["message"],
        expression_id=bar.id,
        method="MASK",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const bar = new newrelic.ObfuscationExpression("bar", {
    description: "description of the expression",
    regex: "(^http)",
});
const foo = new newrelic.ObfuscationRule("foo", {
    description: "description of the rule",
    filter: "hostStatus=running",
    enabled: true,
    actions: [{
        attributes: ["message"],
        expressionId: bar.id,
        method: "MASK",
    }],
});
resources:
  bar:
    type: newrelic:ObfuscationExpression
    properties:
      description: description of the expression
      regex: (^http)
  foo:
    type: newrelic:ObfuscationRule
    properties:
      description: description of the rule
      filter: hostStatus=running
      enabled: true
      actions:
        - attributes:
            - message
          expressionId: ${bar.id}
          method: MASK

Create ObfuscationRule Resource

new ObfuscationRule(name: string, args: ObfuscationRuleArgs, opts?: CustomResourceOptions);
@overload
def ObfuscationRule(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    account_id: Optional[int] = None,
                    actions: Optional[Sequence[ObfuscationRuleActionArgs]] = None,
                    description: Optional[str] = None,
                    enabled: Optional[bool] = None,
                    filter: Optional[str] = None,
                    name: Optional[str] = None)
@overload
def ObfuscationRule(resource_name: str,
                    args: ObfuscationRuleArgs,
                    opts: Optional[ResourceOptions] = None)
func NewObfuscationRule(ctx *Context, name string, args ObfuscationRuleArgs, opts ...ResourceOption) (*ObfuscationRule, error)
public ObfuscationRule(string name, ObfuscationRuleArgs args, CustomResourceOptions? opts = null)
public ObfuscationRule(String name, ObfuscationRuleArgs args)
public ObfuscationRule(String name, ObfuscationRuleArgs args, CustomResourceOptions options)
type: newrelic:ObfuscationRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ObfuscationRuleArgs
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 ObfuscationRuleArgs
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 ObfuscationRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ObfuscationRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ObfuscationRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Actions List<Pulumi.NewRelic.Inputs.ObfuscationRuleActionArgs>

Actions for the rule. The actions will be applied in the order specified by this list.

Enabled bool

Whether the rule should be applied or not to incoming data.

Filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

AccountId int

The account id associated with the obfuscation rule.

Description string

Description of rule.

Name string

Name of rule.

Actions []ObfuscationRuleActionArgs

Actions for the rule. The actions will be applied in the order specified by this list.

Enabled bool

Whether the rule should be applied or not to incoming data.

Filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

AccountId int

The account id associated with the obfuscation rule.

Description string

Description of rule.

Name string

Name of rule.

actions List<ObfuscationRuleActionArgs>

Actions for the rule. The actions will be applied in the order specified by this list.

enabled Boolean

Whether the rule should be applied or not to incoming data.

filter String

NRQL for determining whether a given log record should have obfuscation actions applied.

accountId Integer

The account id associated with the obfuscation rule.

description String

Description of rule.

name String

Name of rule.

actions ObfuscationRuleActionArgs[]

Actions for the rule. The actions will be applied in the order specified by this list.

enabled boolean

Whether the rule should be applied or not to incoming data.

filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

accountId number

The account id associated with the obfuscation rule.

description string

Description of rule.

name string

Name of rule.

actions Sequence[ObfuscationRuleActionArgs]

Actions for the rule. The actions will be applied in the order specified by this list.

enabled bool

Whether the rule should be applied or not to incoming data.

filter str

NRQL for determining whether a given log record should have obfuscation actions applied.

account_id int

The account id associated with the obfuscation rule.

description str

Description of rule.

name str

Name of rule.

actions List<Property Map>

Actions for the rule. The actions will be applied in the order specified by this list.

enabled Boolean

Whether the rule should be applied or not to incoming data.

filter String

NRQL for determining whether a given log record should have obfuscation actions applied.

accountId Number

The account id associated with the obfuscation rule.

description String

Description of rule.

name String

Name of rule.

Outputs

All input properties are implicitly available as output properties. Additionally, the ObfuscationRule 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 ObfuscationRule Resource

Get an existing ObfuscationRule 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?: ObfuscationRuleState, opts?: CustomResourceOptions): ObfuscationRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[int] = None,
        actions: Optional[Sequence[ObfuscationRuleActionArgs]] = None,
        description: Optional[str] = None,
        enabled: Optional[bool] = None,
        filter: Optional[str] = None,
        name: Optional[str] = None) -> ObfuscationRule
func GetObfuscationRule(ctx *Context, name string, id IDInput, state *ObfuscationRuleState, opts ...ResourceOption) (*ObfuscationRule, error)
public static ObfuscationRule Get(string name, Input<string> id, ObfuscationRuleState? state, CustomResourceOptions? opts = null)
public static ObfuscationRule get(String name, Output<String> id, ObfuscationRuleState 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:
AccountId int

The account id associated with the obfuscation rule.

Actions List<Pulumi.NewRelic.Inputs.ObfuscationRuleActionArgs>

Actions for the rule. The actions will be applied in the order specified by this list.

Description string

Description of rule.

Enabled bool

Whether the rule should be applied or not to incoming data.

Filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

Name string

Name of rule.

AccountId int

The account id associated with the obfuscation rule.

Actions []ObfuscationRuleActionArgs

Actions for the rule. The actions will be applied in the order specified by this list.

Description string

Description of rule.

Enabled bool

Whether the rule should be applied or not to incoming data.

Filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

Name string

Name of rule.

accountId Integer

The account id associated with the obfuscation rule.

actions List<ObfuscationRuleActionArgs>

Actions for the rule. The actions will be applied in the order specified by this list.

description String

Description of rule.

enabled Boolean

Whether the rule should be applied or not to incoming data.

filter String

NRQL for determining whether a given log record should have obfuscation actions applied.

name String

Name of rule.

accountId number

The account id associated with the obfuscation rule.

actions ObfuscationRuleActionArgs[]

Actions for the rule. The actions will be applied in the order specified by this list.

description string

Description of rule.

enabled boolean

Whether the rule should be applied or not to incoming data.

filter string

NRQL for determining whether a given log record should have obfuscation actions applied.

name string

Name of rule.

account_id int

The account id associated with the obfuscation rule.

actions Sequence[ObfuscationRuleActionArgs]

Actions for the rule. The actions will be applied in the order specified by this list.

description str

Description of rule.

enabled bool

Whether the rule should be applied or not to incoming data.

filter str

NRQL for determining whether a given log record should have obfuscation actions applied.

name str

Name of rule.

accountId Number

The account id associated with the obfuscation rule.

actions List<Property Map>

Actions for the rule. The actions will be applied in the order specified by this list.

description String

Description of rule.

enabled Boolean

Whether the rule should be applied or not to incoming data.

filter String

NRQL for determining whether a given log record should have obfuscation actions applied.

name String

Name of rule.

Supporting Types

ObfuscationRuleAction

Attributes List<string>

Attribute names for action. An empty list applies the action to all the attributes.

ExpressionId string

Expression Id for action.

Method string

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

Attributes []string

Attribute names for action. An empty list applies the action to all the attributes.

ExpressionId string

Expression Id for action.

Method string

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

attributes List<String>

Attribute names for action. An empty list applies the action to all the attributes.

expressionId String

Expression Id for action.

method String

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

attributes string[]

Attribute names for action. An empty list applies the action to all the attributes.

expressionId string

Expression Id for action.

method string

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

attributes Sequence[str]

Attribute names for action. An empty list applies the action to all the attributes.

expression_id str

Expression Id for action.

method str

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

attributes List<String>

Attribute names for action. An empty list applies the action to all the attributes.

expressionId String

Expression Id for action.

method String

Obfuscation method to use. Methods for replacing obfuscated values are HASH_SHA256 and MASK.

Import

New Relic obfuscation rule can be imported using the rule ID, e.g. bash

 $ pulumi import newrelic:index/obfuscationRule:ObfuscationRule foo 34567

Package Details

Repository
New Relic pulumi/pulumi-newrelic
License
Apache-2.0
Notes

This Pulumi package is based on the newrelic Terraform Provider.