### Federated Logs Setup Constructor Example (Java) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of how to instantiate the FederatedLogsSetup resource using Java. ```java var federatedLogsSetupResource = new FederatedLogsSetup("federatedLogsSetupResource", FederatedLogsSetupArgs.builder() .defaultPartition(FederatedLogsSetupDefaultPartitionArgs.builder() .storage(FederatedLogsSetupDefaultPartitionStorageArgs.builder() .dataLocationUri("string") .table("string") .build()) .dataRetentionPolicy(FederatedLogsSetupDefaultPartitionDataRetentionPolicyArgs.builder() .duration(0) .unit("string") .build()) .build()) .storage(FederatedLogsSetupStorageArgs.builder() .cloudProviderConfiguration(FederatedLogsSetupStorageCloudProviderConfigurationArgs.builder() .provider("string") .region("string") .build()) .dataIngestConnectionId("string") .dataLocationBucket("string") .database("string") .queryConnectionId("string") .build()) .accountId("string") .active(false) .description("string") .forwarder(FederatedLogsSetupForwarderArgs.builder() .type("string") .pipelineControl(FederatedLogsSetupForwarderPipelineControlArgs.builder() .fleetId("string") .routingRule(FederatedLogsSetupForwarderPipelineControlRoutingRuleArgs.builder() .expression("string") .build()) .build()) .build()) .name("string") .build()); ``` -------------------------------- ### Federated Logs Setup Example (Python) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of how to configure the FederatedLogsSetup resource using Python. ```python federated_logs_setup_resource = newrelic.FederatedLogsSetup("federatedLogsSetupResource", default_partition={ "storage": { "data_location_uri": "string", "table": "string", }, "data_retention_policy": { "duration": 0, "unit": "string", }, }, storage={ "cloud_provider_configuration": { "provider": "string", "region": "string", }, "data_ingest_connection_id": "string", "data_location_bucket": "string", "database": "string", "query_connection_id": "string", }, account_id="string", active=False, description="string", forwarder={ "type": "string", "pipeline_control": { "fleet_id": "string", "routing_rule": { "expression": "string", }, }, }, name="string") ``` -------------------------------- ### Create Federated Logs Setup Resource (C#) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of creating a New Relic Federated Logs Setup resource using C# with Pulumi. Ensure all required arguments are provided. ```csharp var federatedLogsSetupResource = new NewRelic.FederatedLogsSetup("federatedLogsSetupResource", new() { DefaultPartition = new NewRelic.Inputs.FederatedLogsSetupDefaultPartitionArgs { Storage = new NewRelic.Inputs.FederatedLogsSetupDefaultPartitionStorageArgs { DataLocationUri = "string", Table = "string", }, DataRetentionPolicy = new NewRelic.Inputs.FederatedLogsSetupDefaultPartitionDataRetentionPolicyArgs { Duration = 0, Unit = "string", }, }, Storage = new NewRelic.Inputs.FederatedLogsSetupStorageArgs { CloudProviderConfiguration = new NewRelic.Inputs.FederatedLogsSetupStorageCloudProviderConfigurationArgs { Provider = "string", Region = "string", }, DataIngestConnectionId = "string", DataLocationBucket = "string", Database = "string", QueryConnectionId = "string", }, AccountId = "string", Active = false, Description = "string", Forwarder = new NewRelic.Inputs.FederatedLogsSetupForwarderArgs { Type = "string", PipelineControl = new NewRelic.Inputs.FederatedLogsSetupForwarderPipelineControlArgs { FleetId = "string", RoutingRule = new NewRelic.Inputs.FederatedLogsSetupForwarderPipelineControlRoutingRuleArgs { Expression = "string", }, }, }, Name = "string", }); ``` -------------------------------- ### Create Federated Logs Setup Resource (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of creating a New Relic Federated Logs Setup resource using Go with Pulumi. This demonstrates the structure for configuring log forwarding and storage. ```go example, err := newrelic.NewFederatedLogsSetup(ctx, "federatedLogsSetupResource", &newrelic.FederatedLogsSetupArgs{ DefaultPartition: &newrelic.FederatedLogsSetupDefaultPartitionArgs{ Storage: &newrelic.FederatedLogsSetupDefaultPartitionStorageArgs{ DataLocationUri: pulumi.String("string"), Table: pulumi.String("string"), }, DataRetentionPolicy: &newrelic.FederatedLogsSetupDefaultPartitionDataRetentionPolicyArgs{ Duration: pulumi.Int(0), Unit: pulumi.String("string"), }, }, Storage: &newrelic.FederatedLogsSetupStorageArgs{ CloudProviderConfiguration: &newrelic.FederatedLogsSetupStorageCloudProviderConfigurationArgs{ Provider: pulumi.String("string"), Region: pulumi.String("string"), }, DataIngestConnectionId: pulumi.String("string"), DataLocationBucket: pulumi.String("string"), Database: pulumi.String("string"), QueryConnectionId: pulumi.String("string"), }, AccountId: pulumi.String("string"), Active: pulumi.Bool(false), Description: pulumi.String("string"), Forwarder: &newrelic.FederatedLogsSetupForwarderArgs{ Type: pulumi.String("string"), PipelineControl: &newrelic.FederatedLogsSetupForwarderPipelineControlArgs{ FleetId: pulumi.String("string"), RoutingRule: &newrelic.FederatedLogsSetupForwarderPipelineControlRoutingRuleArgs{ Expression: pulumi.String("string"), }, }, }, Name: pulumi.String("string"), }) ``` -------------------------------- ### Federated Logs Setup Example (TypeScript) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of how to set up federated logs using TypeScript. ```typescript const federatedLogsSetupResource = new newrelic.FederatedLogsSetup("federatedLogsSetupResource", { defaultPartition: { storage: { dataLocationUri: "string", table: "string", }, dataRetentionPolicy: { duration: 0, unit: "string", }, }, storage: { cloudProviderConfiguration: { provider: "string", region: "string", }, dataIngestConnectionId: "string", dataLocationBucket: "string", database: "string", queryConnectionId: "string", }, accountId: "string", active: false, description: "string", forwarder: { type: "string", pipelineControl: { fleetId: "string", routingRule: { expression: "string", }, }, }, name: "string", }); ``` -------------------------------- ### Create a Federated Logs Partition (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogspartition A Go example demonstrating how to provision a federated logs partition. It requires the `setup` variable to be defined and accessible. ```go 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 { _, err := newrelic.NewFederatedLogsPartition(ctx, "foo", &newrelic.FederatedLogsPartitionArgs{ SetupId: pulumi.Any(setup.Id), Name: pulumi.String("test-partition-logs"), Description: pulumi.String("test partition for logs"), Storage: &newrelic.FederatedLogsPartitionStorageArgs{ Table: pulumi.String("my_app_partition_logs"), DataLocationUri: pulumi.String("s3://my-app-fed-logs/my_app_partition_logs"), }, DataRetentionPolicy: &newrelic.FederatedLogsPartitionDataRetentionPolicyArgs{ Duration: pulumi.Int(365), Unit: pulumi.String("DAYS"), }, ForwarderConfiguration: &newrelic.FederatedLogsPartitionForwarderConfigurationArgs{ Type: pulumi.String("PIPELINE_CONTROL"), PipelineControl: &newrelic.FederatedLogsPartitionForwarderConfigurationPipelineControlArgs{ PartitionRule: &newrelic.FederatedLogsPartitionForwarderConfigurationPipelineControlPartitionRuleArgs{ Expression: pulumi.String("attributes[\"log.type\"] == \"partition\""), }, }, }, }) if err != nil { return err } return nil }) } ``` -------------------------------- ### Get Key Transaction Example in C# Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getkeytransaction This C# example shows how to fetch a key transaction using Pulumi's New Relic provider. It's useful for integrating New Relic monitoring into your infrastructure as code. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.NewRelic; return await Deployment.RunAsync(() => { var txn = NewRelic.GetKeyTransaction.Invoke(new() { Name = "txn", }); var foo = new NewRelic.AlertPolicy("foo", new() { Name = "foo", }); var fooAlertCondition = new NewRelic.AlertCondition("foo", new() { PolicyId = foo.Id, Name = "foo", Type = "apm_kt_metric", Entities = new[] { txn.Apply(getKeyTransactionResult => getKeyTransactionResult.Id), }, Metric = "error_percentage", RunbookUrl = "https://www.example.com", Terms = new[] { new NewRelic.Inputs.AlertConditionTermArgs { Duration = 5, Operator = "below", Priority = "critical", Threshold = 0.75, TimeFunction = "all", }, }, }); }); ``` -------------------------------- ### Java Example: Get Alert Channel and Use with Resources Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertchannel A Java example demonstrating how to fetch an alert channel by name and then use its ID with an alert policy to create an alert policy channel. Requires the New Relic Pulumi provider for Java. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.newrelic.NewrelicFunctions; import com.pulumi.newrelic.inputs.GetAlertChannelArgs; import com.pulumi.newrelic.AlertPolicy; import com.pulumi.newrelic.AlertPolicyArgs; import com.pulumi.newrelic.AlertPolicyChannel; import com.pulumi.newrelic.AlertPolicyChannelArgs; import java.util.ArrayList; import java.util.Arrays; 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) { // Data source final var foo = NewrelicFunctions.getAlertChannel(GetAlertChannelArgs.builder() .name("foo@example.com") .build()); // Resource var fooAlertPolicy = new AlertPolicy("fooAlertPolicy", AlertPolicyArgs.builder() .name("foo") .build()); // Using the data source and resource together var fooAlertPolicyChannel = new AlertPolicyChannel("fooAlertPolicyChannel", AlertPolicyChannelArgs.builder() .policyId(fooAlertPolicy.id()) .channelId(foo.id()) .build()); } } ``` -------------------------------- ### Get Key Transaction Example in Python Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getkeytransaction This Python example demonstrates fetching a key transaction by name, typically for use in setting up alert conditions. Ensure the pulumi_newrelic package is installed. ```python import pulumi import pulumi_newrelic as newrelic txn = newrelic.get_key_transaction(name="txn") foo = newrelic.AlertPolicy("foo", name="foo") foo_alert_condition = newrelic.AlertCondition("foo", policy_id=foo.id, name="foo", type="apm_kt_metric", entities=[txn.id], metric="error_percentage", runbook_url="https://www.example.com", terms=[{ "duration": 5, "operator": "below", "priority": "critical", "threshold": 0.75, "time_function": "all", }]) ``` -------------------------------- ### TypeScript Example for One-Time Monitor Downtime Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/monitordowntime This example demonstrates how to create a one-time monitor downtime using Pulumi with TypeScript. It requires the New Relic provider and configures the downtime with a name, monitor GUIDs, mode, start and end times, and time zone. ```typescript import * as pulumi from "@pulumi/pulumi"; import * as newrelic from "@pulumi/newrelic"; const sampleOneTimeNewrelicMonitorDowntime = new newrelic.MonitorDowntime("sample_one_time_newrelic_monitor_downtime", { name: "Sample One Time Monitor Downtime", monitorGuids: [ "", "", ], mode: "ONE_TIME", startTime: "2023-12-04T10:15:00", endTime: "2024-01-04T16:24:30", timeZone: "America/Los_Angeles", }); ``` -------------------------------- ### Go Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/nrqldroprule Example of instantiating a NrqlDropRule resource in Go. ```go example, err := newrelic.NewNrqlDropRule(ctx, "nrqlDropRuleResource", &newrelic.NrqlDropRuleArgs{ Action: pulumi.String("string"), Nrql: pulumi.String("string"), AccountId: pulumi.String("string"), Description: pulumi.String("string"), }) ``` -------------------------------- ### Python Example: Get Alert Channel and Use with Resources Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertchannel Shows how to retrieve an alert channel by name and then utilize its ID with an alert policy to configure an alert policy channel. Ensure `pulumi_newrelic` is installed. ```python import pulumi import pulumi_newrelic as newrelic # Data source foo = newrelic.get_alert_channel(name="foo@example.com") # Resource foo_alert_policy = newrelic.AlertPolicy("foo", name="foo") # Using the data source and resource together foo_alert_policy_channel = newrelic.AlertPolicyChannel("foo", policy_id=foo_alert_policy.id, channel_id=foo.id) ``` -------------------------------- ### Get Obfuscation Expression and Create Obfuscation Rule in C# Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getobfuscationexpression This C# example shows how to retrieve an obfuscation expression and then define an obfuscation rule that uses the expression's ID. Ensure the Pulumi.NewRelic package is installed and the deployment is configured. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.NewRelic; return await Deployment.RunAsync(() => { var expression = NewRelic.GetObfuscationExpression.Invoke(new() { AccountId = "123456", Name = "The expression", }); var rule = new NewRelic.ObfuscationRule("rule", new() { Name = "ruleName", Description = "description of the rule", Filter = "hostStatus=running", Enabled = true, Actions = new[] { new NewRelic.Inputs.ObfuscationRuleActionArgs { Attributes = new[] { "message", }, ExpressionId = expression.Apply(getObfuscationExpressionResult => getObfuscationExpressionResult.Id), Method = "MASK", }, }, }); }); ``` -------------------------------- ### Go Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/metricpruningrule Example of creating a MetricPruningRule resource in Go. ```go example, err := newrelic.NewMetricPruningRule(ctx, "metricPruningRuleResource", &newrelic.MetricPruningRuleArgs{ Nrql: pulumi.String("string"), AccountId: pulumi.String("string"), Description: pulumi.String("string"), }) ``` -------------------------------- ### Go Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/fleetmembers Example of creating a FleetMembers resource in Go. ```go example, err := newrelic.NewFleetMembers(ctx, "fleetMembersResource", &newrelic.FleetMembersArgs{ FleetId: pulumi.String("string"), Rings: newrelic.FleetMembersRingArray{ &newrelic.FleetMembersRingArgs{ EntityIds: pulumi.StringArray{ pulumi.String("string"), }, Name: pulumi.String("string"), }, }, }) ``` -------------------------------- ### HCL Example for Weekly Monitor Downtime Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/monitordowntime This snippet shows how to configure a weekly monitor downtime using HCL. It specifies the name, associated monitor GUIDs, mode, start and end times, time zone, and end repeat date. ```hcl pulumi { required_providers { newrelic = { source = "pulumi/newrelic" } } } resource "newrelic_monitordowntime" "foo" { name = "Sample Monitor Downtime" monitor_guids = ["", ""] mode = "WEEKLY" start_time = "2023-11-30T10:30:00" end_time = "2023-12-10T02:45:30" time_zone = "Asia/Kolkata" end_repeat = { on_date = "2023-12-20" } maintenance_days = ["FRIDAY", "SATURDAY"] } ``` -------------------------------- ### PipelineCloudRule Resource Creation Example (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/pipelinecloudrule Demonstrates how to create a PipelineCloudRule resource in Go using placeholder values. ```go example, err := newrelic.NewPipelineCloudRule(ctx, "pipelineCloudRuleResource", &newrelic.PipelineCloudRuleArgs{ Nrql: pulumi.String("string"), AccountId: pulumi.String("string"), Description: pulumi.String("string"), Name: pulumi.String("string"), }) ``` -------------------------------- ### Create Data Partition Rule (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/datapartitionrule Example of creating a Data Partition Rule using Go. This snippet demonstrates how to instantiate the rule with required arguments. ```go example, err := newrelic.NewDataPartitionRule(ctx, "dataPartitionRuleResource", &newrelic.DataPartitionRuleArgs{ Enabled: pulumi.Bool(false), Nrql: pulumi.String("string"), RetentionPolicy: pulumi.String("string"), TargetDataPartition: pulumi.String("string"), AccountId: pulumi.String("string"), Description: pulumi.String("string"), }) ``` -------------------------------- ### Apply Multiple Tags to Multiple Entities (HCL) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/entitytags Applies a set of custom tags to multiple New Relic applications using HCL. This example defines local variables for apps and tags, then uses a data source to get entity GUIDs and a resource to apply the tags. ```hcl pulumi { required_providers { newrelic = { source = "pulumi/newrelic" } std = { source = "pulumi/std" } } } data "newrelic_getentity" "invoke_0" { for_each = local.apps name = each.key type = "APPLICATION" domain = "APM" } # Note: each.key and each.value are the same for a set resource "newrelic_entitytags" "foo" { for_each = local.apps dynamic "tags" { for_each = entries(local.customTags) content { key = tags.value.key values = [tags.value.value] } } guid = local.foo[each.key].guid } locals { apps = toset(["Example App Name 1", "Example App Name 2"]) } locals { customTags = { "tag-key-1" = "tag-value-1" "tag-key-2" = "tag-value-2" "tag-key-3" = "tag-value-3" } } locals { foo = {for __key, __value in local.apps : __key => data.newrelic_getentity.invoke_0[__key]} } ``` -------------------------------- ### Get New Relic Account by Name (C#) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getaccount This C# example shows how to get a New Relic account by its name using the Pulumi New Relic provider. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.Newrelic; return await Deployment.RunAsync(() => { var example = NewRelic.GetAccount.Invoke(new() { Name = "Test Account", }); }); ``` -------------------------------- ### Go Constructor Syntax Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/workflow Demonstrates the constructor syntax for the Workflow resource in Go. ```go func NewWorkflow(ctx *Context, name string, args WorkflowArgs, opts ...ResourceOption) (*Workflow, error) ``` -------------------------------- ### Import AWS Connection by Entity GUID Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/awsconnection Use this command to import an existing AWS Connection into your Pulumi New Relic setup. You will need the entity GUID of the connection. ```bash $ pulumi import newrelic:index/awsConnection:AwsConnection foo ``` -------------------------------- ### Java Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/nrqldroprule Example of creating a NrqlDropRule resource in Java. ```java var nrqlDropRuleResource = new NrqlDropRule("nrqlDropRuleResource", NrqlDropRuleArgs.builder() .action("string") .nrql("string") .accountId("string") .description("string") .build()); ``` -------------------------------- ### Import Federated Logs Setup Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Use this command to import an existing Federated Logs setup into your Pulumi stack. Replace `` with the actual GUID of the New Relic entity. ```bash $ pulumi import newrelic:index/federatedLogsSetup:FederatedLogsSetup foo ``` -------------------------------- ### Create AccountManagement Resource Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/accountmanagement Example of creating an AccountManagement resource in Go. ```go example, err := newrelic.NewAccountManagement(ctx, "accountManagementResource", &newrelic.AccountManagementArgs{ Region: pulumi.String("string"), Name: pulumi.String("string"), }) ``` -------------------------------- ### User Resource Creation Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/user Provides a reference example for creating a User resource with placeholder values. Ensure all required properties are provided for successful resource creation. ```csharp var userResource = new NewRelic.User("userResource", new() { AuthenticationDomainId = "string", EmailId = "string", Name = "string", UserType = "string", }); ``` ```go example, err := newrelic.NewUser(ctx, "userResource", &newrelic.UserArgs{ AuthenticationDomainId: pulumi.String("string"), EmailId: pulumi.String("string"), Name: pulumi.String("string"), UserType: pulumi.String("string"), }) ``` ```hcl resource "newrelic_user" "userResource" { authentication_domain_id = "string" email_id = "string" name = "string" user_type = "string" } ``` ```java var userResource = new User("userResource", UserArgs.builder() .authenticationDomainId("string") .emailId("string") .name("string") .userType("string") .build()); ``` ```python user_resource = newrelic.User("userResource", authentication_domain_id="string", email_id="string", name="string", user_type="string") ``` ```typescript const userResource = new newrelic.User("userResource", { authenticationDomainId: "string", emailId: "string", name: "string", userType: "string", }); ``` ```yaml type: newrelic:User properties: authenticationDomainId: string emailId: string name: string userType: string ``` -------------------------------- ### YAML Get Key Transaction Invocation Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getkeytransaction Example of invoking the newrelic_index/getKeyTransaction function using YAML. ```yaml fn::invoke: function: newrelic:index/getKeyTransaction:getKeyTransaction arguments: # arguments dictionary ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (HCL) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```hcl pulumi { required_providers { newrelic = { source = "pulumi/newrelic" } } } data "newrelic_getfleetconfiguration" "byVersion" { version_entity_id = "NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw..." } output "versionContent" { value = data.newrelic_getfleetconfiguration.byVersion.configuration_content } output "parentConfigGuid" { value = data.newrelic_getfleetconfiguration.byVersion.configuration_id } ``` -------------------------------- ### Go Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/onedashboardjson Example of creating a OneDashboardJson resource in Go. ```go example, err := newrelic.NewOneDashboardJson(ctx, "oneDashboardJsonResource", &newrelic.OneDashboardJsonArgs{ Json: pulumi.String("string"), AccountId: pulumi.String("string"), }) ``` -------------------------------- ### Deploy Fleet Configuration and Deployment (TypeScript) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/fleetdeployment This example shows how to first create a fleet configuration with specific settings and then deploy an agent to a fleet, linking it to the created configuration version. ```typescript import * as pulumi from "@pulumi/pulumi"; import * as newrelic from "@pulumi/newrelic"; const infraCfg = new newrelic.FleetConfiguration("infra_cfg", { name: "Production Infra Config", agentType: "NRInfra", managedEntityType: "HOST", versions: [{ configurationContent: `log: level: info `, }], }); const infra = new newrelic.FleetDeployment("infra", { fleetId: prod.id, name: "Production Infra Deployment", description: "Deploys NRInfra v1.58.0 with the production config", agents: [{ agentType: "NRInfra", version: "1.58.0", configurationVersionId: infraCfg.latestVersionEntityId, }], }); ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (YAML) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```yaml variables: byVersion: fn::invoke: function: newrelic:getFleetConfiguration arguments: versionEntityId: NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw... outputs: versionContent: ${byVersion.configurationContent} parentConfigGuid: ${byVersion.configurationId} ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (Java) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.newrelic.NewrelicFunctions; import com.pulumi.newrelic.inputs.GetFleetConfigurationArgs; import java.util.ArrayList; import java.util.Arrays; 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 byVersion = NewrelicFunctions.getFleetConfiguration(GetFleetConfigurationArgs.builder() .versionEntityId("NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw...") .build()); ctx.export("versionContent", byVersion.configurationContent()); ctx.export("parentConfigGuid", byVersion.configurationId()); } } ``` -------------------------------- ### Go Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/apiaccesskey Example of creating an ApiAccessKey resource in Go using the NewApiAccessKey function. ```go example, err := newrelic.NewApiAccessKey(ctx, "apiAccessKeyResource", &newrelic.ApiAccessKeyArgs{ KeyType: pulumi.String("string"), AccountId: pulumi.String("string"), IngestType: pulumi.String("string"), Name: pulumi.String("string"), Notes: pulumi.String("string"), UserId: pulumi.String("string"), }) ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (C#) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.Newrelic; return await Deployment.RunAsync(() => { var byVersion = NewRelic.GetFleetConfiguration.Invoke(new() { VersionEntityId = "NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw...", }); return new Dictionary { ["versionContent"] = byVersion.Apply(getFleetConfigurationResult => getFleetConfigurationResult.ConfigurationContent), ["parentConfigGuid"] = byVersion.Apply(getFleetConfigurationResult => getFleetConfigurationResult.ConfigurationId), }; }); ``` -------------------------------- ### KeyTransaction Constructor Example (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/keytransaction Example of creating a KeyTransaction resource in Go, including necessary arguments and options. ```go example, err := newrelic.NewKeyTransaction(ctx, "keyTransactionResource", &newrelic.KeyTransactionArgs{ ApdexIndex: pulumi.Float64(0), ApplicationGuid: pulumi.String("string"), BrowserApdexTarget: pulumi.Float64(0), MetricName: pulumi.String("string"), Name: pulumi.String("string"), }) ``` -------------------------------- ### Python Resource Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/alertpolicychannel Demonstrates creating an AlertPolicyChannel resource in Python with channel IDs, policy ID, and account ID. ```python alert_policy_channel_resource = newrelic.AlertPolicyChannel("alertPolicyChannelResource", channel_ids=["string"], policy_id="string", account_id="string") ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```go 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 { byVersion, err := newrelic.GetFleetConfiguration(ctx, &newrelic.LookupFleetConfigurationArgs{ VersionEntityId: pulumi.StringRef("NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw..."), }, nil) if err != nil { return err } ctx.Export("versionContent", byVersion.ConfigurationContent) ctx.Export("parentConfigGuid", byVersion.ConfigurationId) return nil }) } ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (Python) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```python import pulumi import pulumi_newrelic as newrelic by_version = newrelic.get_fleet_configuration(version_entity_id="NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw...") pulumi.export("versionContent", by_version.configuration_content) pulumi.export("parentConfigGuid", by_version.configuration_id) ``` -------------------------------- ### WorkflowAutomation Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/workflowautomation Provides a constructor example for the WorkflowAutomation resource in Go. ```go example, err := newrelic.NewWorkflowAutomation(ctx, "workflowAutomationResource", &newrelic.WorkflowAutomationArgs{ Definition: pulumi.String("string"), ScopeId: pulumi.String("string"), ScopeType: pulumi.String("string"), Name: pulumi.String("string"), }) ``` -------------------------------- ### C# Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/nrqldroprule An example of creating a NrqlDropRule resource in C# using placeholder values. ```csharp var nrqlDropRuleResource = new NewRelic.NrqlDropRule("nrqlDropRuleResource", new() { Action = "string", Nrql = "string", AccountId = "string", Description = "string", }); ``` -------------------------------- ### Get Fleet Configuration by Version Entity GUID (TypeScript) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getfleetconfiguration Fetches fleet configuration content and parent GUID using a version entity ID. Use this to retrieve specific configuration versions. ```typescript import * as pulumi from "@pulumi/pulumi"; import * as newrelic from "@pulumi/newrelic"; const byVersion = newrelic.getFleetConfiguration({ versionEntityId: "NjQyNTg2NXxOR0VQfEFHRU5UX0NPTkZJR1VSQVRJT05fVkVSU0lPTnw...", }); export const versionContent = byVersion.then(byVersion => byVersion.configurationContent); export const parentConfigGuid = byVersion.then(byVersion => byVersion.configurationId); ``` -------------------------------- ### C# Example for getApplication Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getapplication This C# example demonstrates how to retrieve a New Relic application by name and use its ID to configure an alert condition. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.NewRelic; return await Deployment.RunAsync(() => { var app = NewRelic.GetApplication.Invoke(new() { Name = "my-app", }); var foo = new NewRelic.AlertPolicy("foo", new() { Name = "foo", }); var fooAlertCondition = new NewRelic.AlertCondition("foo", new() { PolicyId = foo.Id, Name = "foo", Type = "apm_app_metric", Entities = new[] { app.Apply(getApplicationResult => getApplicationResult.Id), }, Metric = "apdex", RunbookUrl = "https://www.example.com", Terms = new[] { new NewRelic.Inputs.AlertConditionTermArgs { Duration = 5, Operator = "below", Priority = "critical", Threshold = 0.75, TimeFunction = "all", }, }, }); }); ``` -------------------------------- ### Configure Federated Logs Setup (Terraform) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/federatedlogssetup Example of configuring a New Relic Federated Logs Setup resource using Terraform. This defines the necessary arguments for storage, account, and forwarder settings. ```terraform resource "newrelic_federatedlogssetup" "federatedLogsSetupResource" { default_partition = { storage = { data_location_uri = "string" table = "string" } data_retention_policy = { duration = 0 unit = "string" } } storage = { cloud_provider_configuration = { provider = "string" region = "string" } data_ingest_connection_id = "string" data_location_bucket = "string" database = "string" query_connection_id = "string" } account_id = "string" active = false description = "string" forwarder = { type = "string" pipeline_control = { fleet_id = "string" routing_rule = { expression = "string" } } } name = "string" } ``` -------------------------------- ### TypeScript Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/nrqldroprule Example of creating a NrqlDropRule resource in TypeScript. ```typescript const nrqlDropRuleResource = new newrelic.NrqlDropRule("nrqlDropRuleResource", { action: "string", nrql: "string", accountId: "string", description: "string", }); ``` -------------------------------- ### Python Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/fleetmembers Example of creating a FleetMembers resource in Python. ```python fleet_members_resource = newrelic.FleetMembers("fleetMembersResource", fleet_id="string", rings=[{ "entity_ids": ["string"], "name": "string", }]) ``` -------------------------------- ### YAML Get Alert Policy Invocation Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertpolicy Example of invoking the getAlertPolicy function using YAML configuration. ```yaml fn::invoke: function: newrelic:index/getAlertPolicy:getAlertPolicy arguments: # arguments dictionary ``` -------------------------------- ### Go AWS Connection Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/awsconnection Example of creating an AWS Connection resource using Go. Requires the Pulumi Go SDK and New Relic provider. ```go example, err := newrelic.NewAwsConnection(ctx, "awsConnectionResource", &newrelic.AwsConnectionArgs{ Credential: &newrelic.AwsConnectionCredentialArgs{ AssumeRole: &newrelic.AwsConnectionCredentialAssumeRoleArgs{ RoleArn: pulumi.String("string"), ExternalId: pulumi.String("string"), }, }, AccountId: pulumi.String("string"), Description: pulumi.String("string"), Enabled: pulumi.Bool(false), ExternalId: pulumi.String("string"), Name: pulumi.String("string"), Region: pulumi.String("string"), ScopeId: pulumi.String("string"), ScopeType: pulumi.String("string"), Settings: newrelic.AwsConnectionSettingArray{ &newrelic.AwsConnectionSettingArgs{ Key: pulumi.String("string"), Value: pulumi.String("string"), }, }, Tags: newrelic.AwsConnectionTagArray{ &newrelic.AwsConnectionTagArgs{ Key: pulumi.String("string"), Values: pulumi.StringArray{ pulumi.String("string"), }, }, }, }) ``` -------------------------------- ### HCL Get Alert Channel Configuration Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertchannel Example of configuring the getAlertChannel data source in HCL for Terraform. ```hcl data "newrelic_getalertchannel" "name" { # arguments } ``` -------------------------------- ### Python ServiceLevel Get Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/servicelevel Retrieve an existing ServiceLevel resource using its name and ID in Python. This function supports optional arguments for description, events, GUID, name, objective, SLI GUID, and SLI ID. ```python @staticmethod def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, description: Optional[str] = None, events: Optional[ServiceLevelEventsArgs] = None, guid: Optional[str] = None, name: Optional[str] = None, objective: Optional[ServiceLevelObjectiveArgs] = None, sli_guid: Optional[str] = None, sli_id: Optional[str] = None) -> ServiceLevel ``` -------------------------------- ### Go Example for getApplication Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getapplication Demonstrates fetching a New Relic application in Go. The application's ID is then utilized when creating an alert condition. ```go 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 { app, err := newrelic.GetApplication(ctx, &newrelic.GetApplicationArgs{ Name: "my-app", }, nil) if err != nil { return err } foo, err := newrelic.NewAlertPolicy(ctx, "foo", &newrelic.AlertPolicyArgs{ Name: pulumi.String("foo"), }) if err != nil { return err } _, err = newrelic.NewAlertCondition(ctx, "foo", &newrelic.AlertConditionArgs{ PolicyId: foo.ID(), Name: pulumi.String("foo"), Type: pulumi.String("apm_app_metric"), Entities: pulumi.StringArray{ pulumi.String(app.Id), }, Metric: pulumi.String("apdex"), RunbookUrl: pulumi.String("https://www.example.com"), Terms: newrelic.AlertConditionTermArray{ &newrelic.AlertConditionTermArgs{ Duration: pulumi.Int(5), Operator: pulumi.String("below"), Priority: pulumi.String("critical"), Threshold: pulumi.Float64(0.75), TimeFunction: pulumi.String("all"), }, }, }) if err != nil { return err } return nil }) } ``` -------------------------------- ### PipelineCloudRule Resource Creation Example (Python) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/pipelinecloudrule Shows a Python example for creating a PipelineCloudRule resource with placeholder input properties. ```python pipeline_cloud_rule_resource = newrelic.PipelineCloudRule("pipelineCloudRuleResource", nrql="string", account_id="string", description="string", name="string") ``` -------------------------------- ### C# Example: Get Alert Channel and Use with Resources Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertchannel Provides a C# example for retrieving an alert channel by name and then using its ID with an alert policy to create an alert policy channel. Ensure the Pulumi.NewRelic package is referenced. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.NewRelic; return await Deployment.RunAsync(() => { // Data source var foo = NewRelic.GetAlertChannel.Invoke(new() { Name = "foo@example.com", }); // Resource var fooAlertPolicy = new NewRelic.AlertPolicy("foo", new() { Name = "foo", }); // Using the data source and resource together var fooAlertPolicyChannel = new NewRelic.AlertPolicyChannel("foo", new() { PolicyId = fooAlertPolicy.Id, ChannelId = foo.Apply(getAlertChannelResult => getAlertChannelResult.Id), }); }); ``` -------------------------------- ### Create Fleet Deployment Resource (Go) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/fleetdeployment Example of creating a New Relic Fleet Deployment resource using Go with placeholder values. ```go example, err := newrelic.NewFleetDeployment(ctx, "fleetDeploymentResource", &newrelic.FleetDeploymentArgs{ FleetId: pulumi.String("string"), Agents: newrelic.FleetDeploymentAgentArray{ &newrelic.FleetDeploymentAgentArgs{ AgentType: pulumi.String("string"), ConfigurationVersionId: pulumi.String("string"), Version: pulumi.String("string"), }, }, Description: pulumi.String("string"), Name: pulumi.String("string"), OrganizationId: pulumi.String("string"), Tags: pulumi.StringArray{ pulumi.String("string"), }, }) ``` -------------------------------- ### HCL: Get ApiAccessKey Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/apiaccesskey Use HCL to define the lookup for an ApiAccessKey resource. This example shows how to reference an existing key by its ID. ```hcl import { to = newrelic_apiaccesskey.example id = "${id}" } ``` -------------------------------- ### Python Constructor Example Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/metricpruningrule Example of creating a MetricPruningRule resource in Python. ```python metric_pruning_rule_resource = newrelic.MetricPruningRule("metricPruningRuleResource", nrql="string", account_id="string", description="string") ``` -------------------------------- ### Configure Email Notification Destination in C# Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/notificationdestination This C# example configures an email notification destination. Ensure you have the Pulumi.NewRelic package installed. ```csharp using System.Collections.Generic; using System.Linq; using Pulumi; using NewRelic = Pulumi.Newrelic; return await Deployment.RunAsync(() => { var foo = new NewRelic.NotificationDestination("foo", new() { AccountId = "12345678", Name = "email-example", Type = "EMAIL", Properties = new[] { new NewRelic.Inputs.NotificationDestinationPropertyArgs { Key = "email", Value = "email@email.com,email2@email.com", }, }, }); }); ``` -------------------------------- ### PipelineCloudRule Resource Creation Example (C#) Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/pipelinecloudrule Provides a C# example for creating a PipelineCloudRule resource with placeholder values. ```csharp var pipelineCloudRuleResource = new NewRelic.PipelineCloudRule("pipelineCloudRuleResource", new() { Nrql = "string", AccountId = "string", Description = "string", Name = "string", }); ``` -------------------------------- ### HCL Example: Get Alert Channel and Use with Resources Source: https://www.pulumi.com/registry/packages/newrelic/api-docs/getalertchannel HashiCorp Configuration Language (HCL) example for retrieving an alert channel by name and using its ID with an alert policy to create an alert policy channel. This is for Pulumi's HCL provider. ```hcl pulumi { required_providers { newrelic = { source = "pulumi/newrelic" } } } data "newrelic_getalertchannel" "foo" { name = "foo@example.com" } # Resource resource "newrelic_alertpolicy" "foo" { name = "foo" } # Using the data source and resource together resource "newrelic_alertpolicychannel" "foo" { policy_id = newrelic_alertpolicy.foo.id channel_id = data.newrelic_getalertchannel.foo.id } # Data source ```