datadog.ApplicationKey
Provides a Datadog Application Key resource. This can be used to create and manage Datadog Application Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. Securely store your application keys using a secret management system or use this resource to create and manage new application keys.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
// Source the permissions for scoped keys
const ddPerms = datadog.getPermissions({});
// Create an unrestricted Application Key
// This key inherits all permissions of the user that owns the key
const unrestrictedKey = new datadog.ApplicationKey("unrestricted_key", {name: "Unrestricted Application Key"});
// Create a scoped Application Key for monitor management
const monitorManagementKey = new datadog.ApplicationKey("monitor_management_key", {
name: "Monitor Management Key",
scopes: [
ddPerms.then(ddPerms => ddPerms.permissions?.monitorsRead),
ddPerms.then(ddPerms => ddPerms.permissions?.monitorsWrite),
],
});
import pulumi
import pulumi_datadog as datadog
# Source the permissions for scoped keys
dd_perms = datadog.get_permissions()
# Create an unrestricted Application Key
# This key inherits all permissions of the user that owns the key
unrestricted_key = datadog.ApplicationKey("unrestricted_key", name="Unrestricted Application Key")
# Create a scoped Application Key for monitor management
monitor_management_key = datadog.ApplicationKey("monitor_management_key",
name="Monitor Management Key",
scopes=[
dd_perms.permissions["monitorsRead"],
dd_perms.permissions["monitorsWrite"],
])
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Source the permissions for scoped keys
ddPerms, err := datadog.GetPermissions(ctx, &datadog.GetPermissionsArgs{}, nil)
if err != nil {
return err
}
// Create an unrestricted Application Key
// This key inherits all permissions of the user that owns the key
_, err = datadog.NewApplicationKey(ctx, "unrestricted_key", &datadog.ApplicationKeyArgs{
Name: pulumi.String("Unrestricted Application Key"),
})
if err != nil {
return err
}
// Create a scoped Application Key for monitor management
_, err = datadog.NewApplicationKey(ctx, "monitor_management_key", &datadog.ApplicationKeyArgs{
Name: pulumi.String("Monitor Management Key"),
Scopes: pulumi.StringArray{
pulumi.String(ddPerms.Permissions.MonitorsRead),
pulumi.String(ddPerms.Permissions.MonitorsWrite),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
// Source the permissions for scoped keys
var ddPerms = Datadog.GetPermissions.Invoke();
// Create an unrestricted Application Key
// This key inherits all permissions of the user that owns the key
var unrestrictedKey = new Datadog.ApplicationKey("unrestricted_key", new()
{
Name = "Unrestricted Application Key",
});
// Create a scoped Application Key for monitor management
var monitorManagementKey = new Datadog.ApplicationKey("monitor_management_key", new()
{
Name = "Monitor Management Key",
Scopes = new[]
{
ddPerms.Apply(getPermissionsResult => getPermissionsResult.Permissions?.MonitorsRead),
ddPerms.Apply(getPermissionsResult => getPermissionsResult.Permissions?.MonitorsWrite),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.DatadogFunctions;
import com.pulumi.datadog.inputs.GetPermissionsArgs;
import com.pulumi.datadog.ApplicationKey;
import com.pulumi.datadog.ApplicationKeyArgs;
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) {
// Source the permissions for scoped keys
final var ddPerms = DatadogFunctions.getPermissions(GetPermissionsArgs.builder()
.build());
// Create an unrestricted Application Key
// This key inherits all permissions of the user that owns the key
var unrestrictedKey = new ApplicationKey("unrestrictedKey", ApplicationKeyArgs.builder()
.name("Unrestricted Application Key")
.build());
// Create a scoped Application Key for monitor management
var monitorManagementKey = new ApplicationKey("monitorManagementKey", ApplicationKeyArgs.builder()
.name("Monitor Management Key")
.scopes(
ddPerms.permissions().monitorsRead(),
ddPerms.permissions().monitorsWrite())
.build());
}
}
resources:
# Create an unrestricted Application Key
# This key inherits all permissions of the user that owns the key
unrestrictedKey:
type: datadog:ApplicationKey
name: unrestricted_key
properties:
name: Unrestricted Application Key
# Create a scoped Application Key for monitor management
monitorManagementKey:
type: datadog:ApplicationKey
name: monitor_management_key
properties:
name: Monitor Management Key
scopes:
- ${ddPerms.permissions.monitorsRead}
- ${ddPerms.permissions.monitorsWrite}
variables:
# Source the permissions for scoped keys
ddPerms:
fn::invoke:
function: datadog:getPermissions
arguments: {}
Create ApplicationKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApplicationKey(name: string, args: ApplicationKeyArgs, opts?: CustomResourceOptions);@overload
def ApplicationKey(resource_name: str,
args: ApplicationKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApplicationKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
scopes: Optional[Sequence[str]] = None)func NewApplicationKey(ctx *Context, name string, args ApplicationKeyArgs, opts ...ResourceOption) (*ApplicationKey, error)public ApplicationKey(string name, ApplicationKeyArgs args, CustomResourceOptions? opts = null)
public ApplicationKey(String name, ApplicationKeyArgs args)
public ApplicationKey(String name, ApplicationKeyArgs args, CustomResourceOptions options)
type: datadog:ApplicationKey
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 ApplicationKeyArgs
- 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 ApplicationKeyArgs
- 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 ApplicationKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApplicationKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApplicationKeyArgs
- 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 applicationKeyResource = new Datadog.ApplicationKey("applicationKeyResource", new()
{
Name = "string",
Scopes = new[]
{
"string",
},
});
example, err := datadog.NewApplicationKey(ctx, "applicationKeyResource", &datadog.ApplicationKeyArgs{
Name: pulumi.String("string"),
Scopes: pulumi.StringArray{
pulumi.String("string"),
},
})
var applicationKeyResource = new ApplicationKey("applicationKeyResource", ApplicationKeyArgs.builder()
.name("string")
.scopes("string")
.build());
application_key_resource = datadog.ApplicationKey("applicationKeyResource",
name="string",
scopes=["string"])
const applicationKeyResource = new datadog.ApplicationKey("applicationKeyResource", {
name: "string",
scopes: ["string"],
});
type: datadog:ApplicationKey
properties:
name: string
scopes:
- string
ApplicationKey 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 ApplicationKey resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ApplicationKey resource produces the following output properties:
Look up Existing ApplicationKey Resource
Get an existing ApplicationKey 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?: ApplicationKeyState, opts?: CustomResourceOptions): ApplicationKey@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
key: Optional[str] = None,
name: Optional[str] = None,
scopes: Optional[Sequence[str]] = None) -> ApplicationKeyfunc GetApplicationKey(ctx *Context, name string, id IDInput, state *ApplicationKeyState, opts ...ResourceOption) (*ApplicationKey, error)public static ApplicationKey Get(string name, Input<string> id, ApplicationKeyState? state, CustomResourceOptions? opts = null)public static ApplicationKey get(String name, Output<String> id, ApplicationKeyState state, CustomResourceOptions options)resources: _: type: datadog:ApplicationKey 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.
Import
The pulumi import command can be used, for example:
$ pulumi import datadog:index/applicationKey:ApplicationKey foo 11111111-2222-3333-4444-555555555555
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
datadogTerraform Provider.
