1. Packages
  2. New Relic
  3. API Docs
  4. ApiAccessKey
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

newrelic.ApiAccessKey

Explore with Pulumi AI

newrelic logo
New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi

    Use this resource to programmatically create and manage the following types of keys:

    Please visit the New Relic article ‘Use NerdGraph to manage license keys and User API keys’ for more information.

    IMPORTANT! Please be very careful when updating existing newrelic.ApiAccessKey resources as only newrelic_api_access_key.name and newrelic_api_access_key.notes are updatable. All other resource attributes will force a resource recreation which will invalidate the previous API key(s).

    Example Usage

    resource "newrelic_api_access_key" "foobar" {
      account_id  = 1234567
      key_type    = "INGEST"
      ingest_type = "LICENSE"
      name        = "APM Ingest License Key"
      notes       = "To be used with service X"
    }
    

    WARNING: Creating ‘Ingest - License’ and ‘Ingest - Browser’ keys using this resource is restricted to ‘core’ or ‘full platform’ New Relic user accounts. If you’ve signed up as a ‘basic’ user with New Relic, or have been added as a ‘basic’ user to your organization on New Relic, you would not be able to use your account to create ‘Ingest’ keys. If you see the message "You do not have permission to create this key" in the response of the API called by this resource, it could be owing to the aforementioned. For more insights into user account types on New Relic and associated privileges, please check out this page.

    Extended Usage

    This module may be used to create a user or ingest key using the create_access_keys_service resource, and fetch the created key using fetch_access_keys_service, by performing a NerdGraph query under the hood, using the ID of the key created via the resource to fetch the created key. Please refer
    create access keys and fetch access keys for more info.

    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,
                     account_id: Optional[str] = None,
                     key_type: 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()
    {
        AccountId = "string",
        KeyType = "string",
        IngestType = "string",
        Name = "string",
        Notes = "string",
        UserId = "string",
    });
    
    example, err := newrelic.NewApiAccessKey(ctx, "apiAccessKeyResource", &newrelic.ApiAccessKeyArgs{
    	AccountId:  pulumi.String("string"),
    	KeyType:    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()
        .accountId("string")
        .keyType("string")
        .ingestType("string")
        .name("string")
        .notes("string")
        .userId("string")
        .build());
    
    api_access_key_resource = newrelic.ApiAccessKey("apiAccessKeyResource",
        account_id="string",
        key_type="string",
        ingest_type="string",
        name="string",
        notes="string",
        user_id="string")
    
    const apiAccessKeyResource = new newrelic.ApiAccessKey("apiAccessKeyResource", {
        accountId: "string",
        keyType: "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:

    AccountId string
    The New Relic account ID of the account you wish to create the API access key.
    KeyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    IngestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    Name string
    The name of the key.
    Notes string
    Any notes about this ingest key.
    UserId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    AccountId string
    The New Relic account ID of the account you wish to create the API access key.
    KeyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    IngestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    Name string
    The name of the key.
    Notes string
    Any notes about this ingest key.
    UserId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId String
    The New Relic account ID of the account you wish to create the API access key.
    keyType String
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    ingestType String
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    name String
    The name of the key.
    notes String
    Any notes about this ingest key.
    userId String
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId string
    The New Relic account ID of the account you wish to create the API access key.
    keyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    ingestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    name string
    The name of the key.
    notes string
    Any notes about this ingest key.
    userId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    account_id str
    The New Relic account ID of the account you wish to create the API access key.
    key_type str
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    ingest_type str
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    name str
    The name of the key.
    notes str
    Any notes about this ingest key.
    user_id str
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId String
    The New Relic account ID of the account you wish to create the API access key.
    keyType String
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    ingestType String
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    name String
    The name of the key.
    notes String
    Any notes about this ingest key.
    userId String
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    id string
    The provider-assigned unique ID for this managed resource.
    key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    id str
    The provider-assigned unique ID for this managed resource.
    key str
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.

    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) -> ApiAccessKey
    func 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)
    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 string
    The New Relic account ID of the account you wish to create the API access key.
    IngestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    Key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    KeyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    Name string
    The name of the key.
    Notes string
    Any notes about this ingest key.
    UserId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    AccountId string
    The New Relic account ID of the account you wish to create the API access key.
    IngestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    Key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    KeyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    Name string
    The name of the key.
    Notes string
    Any notes about this ingest key.
    UserId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId String
    The New Relic account ID of the account you wish to create the API access key.
    ingestType String
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    key String
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    keyType String
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    name String
    The name of the key.
    notes String
    Any notes about this ingest key.
    userId String
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId string
    The New Relic account ID of the account you wish to create the API access key.
    ingestType string
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    key string
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    keyType string
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    name string
    The name of the key.
    notes string
    Any notes about this ingest key.
    userId string
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    account_id str
    The New Relic account ID of the account you wish to create the API access key.
    ingest_type str
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    key str
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    key_type str
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    name str
    The name of the key.
    notes str
    Any notes about this ingest key.
    user_id str
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.
    accountId String
    The New Relic account ID of the account you wish to create the API access key.
    ingestType String
    Required if key_type = INGEST. Valid options are BROWSER or LICENSE, case-sensitive.
    key String
    The actual API key. This attribute is masked and not be visible in your terminal, CI, etc.
    keyType String
    What type of API key to create. Valid options are INGEST or USER, case-sensitive.
    name String
    The name of the key.
    notes String
    Any notes about this ingest key.
    userId String
    Required if key_type = USER. The New Relic user ID yous wish to create the API access key for in an account.

    Import

    Existing API access keys can be imported using a composite ID of <api_access_key_id>:<key_type>. <key_type> will be either INGEST or USER.

    For example:

    $ pulumi import newrelic:index/apiAccessKey:ApiAccessKey foobar "1234567:INGEST"
    

    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 newrelic Terraform Provider.
    newrelic logo
    New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi