Use this resource to programmatically create and manage the following types of keys in New Relic:
- User API keys
- License (or ingest) keys, including:
- General (Ingest) license keys used for APM
- Browser license keys
Refer to the New Relic article ‘Use NerdGraph to manage license keys and User API keys’ for detailed information.
WARNING: When creating a User API key, if a truncated API key appears in the state after the first
pulumi up, it is likely because the API key was created for a user other than the one running Terraform. This is a security measure by the New Relic API to prevent exposing the full key value when an API key is created for another user. See the Important Considerations section below for more details.
Example Usage
Example: Creating a User API Key
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const userApiKey = new newrelic.ApiAccessKey("user_api_key", {
accountId: "1234321",
keyType: "USER",
userId: "1001111101",
name: "User API Key for Admin Access",
notes: "This key is used for managing user-level API access.",
});
import pulumi
import pulumi_newrelic as newrelic
user_api_key = newrelic.ApiAccessKey("user_api_key",
account_id="1234321",
key_type="USER",
user_id="1001111101",
name="User API Key for Admin Access",
notes="This key is used for managing user-level API access.")
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.NewApiAccessKey(ctx, "user_api_key", &newrelic.ApiAccessKeyArgs{
AccountId: pulumi.String("1234321"),
KeyType: pulumi.String("USER"),
UserId: pulumi.String("1001111101"),
Name: pulumi.String("User API Key for Admin Access"),
Notes: pulumi.String("This key is used for managing user-level API access."),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var userApiKey = new NewRelic.ApiAccessKey("user_api_key", new()
{
AccountId = "1234321",
KeyType = "USER",
UserId = "1001111101",
Name = "User API Key for Admin Access",
Notes = "This key is used for managing user-level API access.",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.ApiAccessKey;
import com.pulumi.newrelic.ApiAccessKeyArgs;
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 userApiKey = new ApiAccessKey("userApiKey", ApiAccessKeyArgs.builder()
.accountId("1234321")
.keyType("USER")
.userId("1001111101")
.name("User API Key for Admin Access")
.notes("This key is used for managing user-level API access.")
.build());
}
}
resources:
userApiKey:
type: newrelic:ApiAccessKey
name: user_api_key
properties:
accountId: 1.234321e+06
keyType: USER
userId: 1.001111101e+09 # Specifies the user ID for whom the key is created
name: User API Key for Admin Access
notes: This key is used for managing user-level API access.
Example: Creating an Ingest License Key
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const ingestLicenseKey = new newrelic.ApiAccessKey("ingest_license_key", {
accountId: "1234321",
keyType: "INGEST",
ingestType: "LICENSE",
name: "Ingest License Key for App Monitoring",
notes: "This key is used for APM and other ingest purposes.",
});
import pulumi
import pulumi_newrelic as newrelic
ingest_license_key = newrelic.ApiAccessKey("ingest_license_key",
account_id="1234321",
key_type="INGEST",
ingest_type="LICENSE",
name="Ingest License Key for App Monitoring",
notes="This key is used for APM and other ingest purposes.")
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.NewApiAccessKey(ctx, "ingest_license_key", &newrelic.ApiAccessKeyArgs{
AccountId: pulumi.String("1234321"),
KeyType: pulumi.String("INGEST"),
IngestType: pulumi.String("LICENSE"),
Name: pulumi.String("Ingest License Key for App Monitoring"),
Notes: pulumi.String("This key is used for APM and other ingest purposes."),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var ingestLicenseKey = new NewRelic.ApiAccessKey("ingest_license_key", new()
{
AccountId = "1234321",
KeyType = "INGEST",
IngestType = "LICENSE",
Name = "Ingest License Key for App Monitoring",
Notes = "This key is used for APM and other ingest purposes.",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.ApiAccessKey;
import com.pulumi.newrelic.ApiAccessKeyArgs;
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 ingestLicenseKey = new ApiAccessKey("ingestLicenseKey", ApiAccessKeyArgs.builder()
.accountId("1234321")
.keyType("INGEST")
.ingestType("LICENSE")
.name("Ingest License Key for App Monitoring")
.notes("This key is used for APM and other ingest purposes.")
.build());
}
}
resources:
ingestLicenseKey:
type: newrelic:ApiAccessKey
name: ingest_license_key
properties:
accountId: 1.234321e+06
keyType: INGEST
ingestType: LICENSE
name: Ingest License Key for App Monitoring
notes: This key is used for APM and other ingest purposes.
Example: Creating an Ingest Browser Key
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const ingestBrowserKey = new newrelic.ApiAccessKey("ingest_browser_key", {
accountId: "1234321",
keyType: "INGEST",
ingestType: "BROWSER",
name: "Browser Monitoring Key",
notes: "This key is used for browser monitoring and analytics.",
});
import pulumi
import pulumi_newrelic as newrelic
ingest_browser_key = newrelic.ApiAccessKey("ingest_browser_key",
account_id="1234321",
key_type="INGEST",
ingest_type="BROWSER",
name="Browser Monitoring Key",
notes="This key is used for browser monitoring and analytics.")
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.NewApiAccessKey(ctx, "ingest_browser_key", &newrelic.ApiAccessKeyArgs{
AccountId: pulumi.String("1234321"),
KeyType: pulumi.String("INGEST"),
IngestType: pulumi.String("BROWSER"),
Name: pulumi.String("Browser Monitoring Key"),
Notes: pulumi.String("This key is used for browser monitoring and analytics."),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var ingestBrowserKey = new NewRelic.ApiAccessKey("ingest_browser_key", new()
{
AccountId = "1234321",
KeyType = "INGEST",
IngestType = "BROWSER",
Name = "Browser Monitoring Key",
Notes = "This key is used for browser monitoring and analytics.",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.ApiAccessKey;
import com.pulumi.newrelic.ApiAccessKeyArgs;
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 ingestBrowserKey = new ApiAccessKey("ingestBrowserKey", ApiAccessKeyArgs.builder()
.accountId("1234321")
.keyType("INGEST")
.ingestType("BROWSER")
.name("Browser Monitoring Key")
.notes("This key is used for browser monitoring and analytics.")
.build());
}
}
resources:
ingestBrowserKey:
type: newrelic:ApiAccessKey
name: ingest_browser_key
properties:
accountId: 1.234321e+06
keyType: INGEST
ingestType: BROWSER
name: Browser Monitoring Key
notes: This key is used for browser monitoring and analytics.
Create ApiAccessKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiAccessKey(name: string, args: ApiAccessKeyArgs, opts?: CustomResourceOptions);@overload
def ApiAccessKey(resource_name: str,
args: ApiAccessKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiAccessKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
key_type: Optional[str] = None,
account_id: Optional[str] = None,
ingest_type: Optional[str] = None,
name: Optional[str] = None,
notes: Optional[str] = None,
user_id: Optional[str] = None)func NewApiAccessKey(ctx *Context, name string, args ApiAccessKeyArgs, opts ...ResourceOption) (*ApiAccessKey, error)public ApiAccessKey(string name, ApiAccessKeyArgs args, CustomResourceOptions? opts = null)
public ApiAccessKey(String name, ApiAccessKeyArgs args)
public ApiAccessKey(String name, ApiAccessKeyArgs args, CustomResourceOptions options)
type: newrelic:ApiAccessKey
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 ApiAccessKeyArgs
- 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 ApiAccessKeyArgs
- 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 ApiAccessKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiAccessKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiAccessKeyArgs
- 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 apiAccessKeyResource = new NewRelic.ApiAccessKey("apiAccessKeyResource", new()
{
KeyType = "string",
AccountId = "string",
IngestType = "string",
Name = "string",
Notes = "string",
UserId = "string",
});
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"),
})
var apiAccessKeyResource = new ApiAccessKey("apiAccessKeyResource", ApiAccessKeyArgs.builder()
.keyType("string")
.accountId("string")
.ingestType("string")
.name("string")
.notes("string")
.userId("string")
.build());
api_access_key_resource = newrelic.ApiAccessKey("apiAccessKeyResource",
key_type="string",
account_id="string",
ingest_type="string",
name="string",
notes="string",
user_id="string")
const apiAccessKeyResource = new newrelic.ApiAccessKey("apiAccessKeyResource", {
keyType: "string",
accountId: "string",
ingestType: "string",
name: "string",
notes: "string",
userId: "string",
});
type: newrelic:ApiAccessKey
properties:
accountId: string
ingestType: string
keyType: string
name: string
notes: string
userId: string
ApiAccessKey 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 ApiAccessKey resource accepts the following input properties:
- Key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- Account
Id string - The New Relic account ID where the API access key will be created.
- Ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - Name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- Notes string
- Additional notes about the API access key.
- User
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- Key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- Account
Id string - The New Relic account ID where the API access key will be created.
- Ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - Name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- Notes string
- Additional notes about the API access key.
- User
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- key
Type String - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- account
Id String - The New Relic account ID where the API access key will be created.
- ingest
Type String - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - name String
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes String
- Additional notes about the API access key.
- user
Id String - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- account
Id string - The New Relic account ID where the API access key will be created.
- ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes string
- Additional notes about the API access key.
- user
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- key_
type str - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- account_
id str - The New Relic account ID where the API access key will be created.
- ingest_
type str - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - name str
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes str
- Additional notes about the API access key.
- user_
id str - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- key
Type String - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- account
Id String - The New Relic account ID where the API access key will be created.
- ingest
Type String - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - name String
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes String
- Additional notes about the API access key.
- user
Id String - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiAccessKey resource produces the following output properties:
Look up Existing ApiAccessKey Resource
Get an existing ApiAccessKey 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?: ApiAccessKeyState, opts?: CustomResourceOptions): ApiAccessKey@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
ingest_type: Optional[str] = None,
key: Optional[str] = None,
key_type: Optional[str] = None,
name: Optional[str] = None,
notes: Optional[str] = None,
user_id: Optional[str] = None) -> ApiAccessKeyfunc GetApiAccessKey(ctx *Context, name string, id IDInput, state *ApiAccessKeyState, opts ...ResourceOption) (*ApiAccessKey, error)public static ApiAccessKey Get(string name, Input<string> id, ApiAccessKeyState? state, CustomResourceOptions? opts = null)public static ApiAccessKey get(String name, Output<String> id, ApiAccessKeyState state, CustomResourceOptions options)resources: _: type: newrelic:ApiAccessKey get: id: ${id}- 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.
- Account
Id string - The New Relic account ID where the API access key will be created.
- Ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - Key string
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- Key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- Name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- Notes string
- Additional notes about the API access key.
- User
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- Account
Id string - The New Relic account ID where the API access key will be created.
- Ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - Key string
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- Key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- Name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- Notes string
- Additional notes about the API access key.
- User
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- account
Id String - The New Relic account ID where the API access key will be created.
- ingest
Type String - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - key String
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- key
Type String - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- name String
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes String
- Additional notes about the API access key.
- user
Id String - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- account
Id string - The New Relic account ID where the API access key will be created.
- ingest
Type string - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - key string
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- key
Type string - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- name string
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes string
- Additional notes about the API access key.
- user
Id string - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- account_
id str - The New Relic account ID where the API access key will be created.
- ingest_
type str - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - key str
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- key_
type str - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- name str
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes str
- Additional notes about the API access key.
- user_
id str - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
- account
Id String - The New Relic account ID where the API access key will be created.
- ingest
Type String - Required if
key_typeisINGEST. Valid options areBROWSERorLICENSE(case-sensitive). - key String
- The actual API key.
- It is important to exercise caution when exporting the value of
key, as it is sensitive information. Avoid logging or exposing it inappropriately.
- It is important to exercise caution when exporting the value of
- key
Type String - The type of API key to create. Valid options are
INGESTorUSER(case-sensitive).- If
key_typeisINGEST, theningest_typemust be specified. - If
key_typeisUSER, thenuser_idmust be specified.
- If
- name String
- The name of the API key.
- Note: While
nameis optional, it is **strongly recommended** to provide a meaningful name for easier identification and management of keys. If anameis not provided, the API will assign a default name when processing the request to create the API key, which may cause unexpected drift in your Terraform state. To prevent this, it is best practice to always specify aname.
- Note: While
- notes String
- Additional notes about the API access key.
- user
Id String - Required if
key_typeisUSER. The New Relic user ID for which the API access key will be created.
Import
ant Considerations
Updating Existing Keys
- Only
nameandnotescan be updated in place. Changes to other attributes will recreate the key (thenewrelic.ApiAccessKeyresource), invalidating the existing one.
Creating API Keys for Other Users
- If an API key is created for a user other than the owner of the API key used to run Terraform, the full key value will not be returned by the API for security reasons. Instead, a truncated version of the key will be provided. To retrieve the full key, ensure the necessary capabilities and access management settings are applied to the user running Terraform. For more details, contact New Relic Support.
Importing Existing Keys into Terraform State
- A key may be imported with its ID using the syntax described in the Import section below. However, the actual value of the key cannot be imported if the key being fetched was created by a user other than the one whose API key is being used to run Terraform. In such cases, the API returns a truncated key for security reasons. For more details, see Use NerdGraph to manage license keys and User API keys.
Account Type Restrictions for Ingest Keys
- Creating
INGESTkeys requires a New Relic user with core or full platform access. See user types.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- New Relic pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.
