1. Packages
  2. Datadog Provider
  3. API Docs
  4. AuthnMapping
Datadog v4.49.0 published on Thursday, Apr 17, 2025 by Pulumi

datadog.AuthnMapping

Explore with Pulumi AI

Provides a Datadog AuthN Mappings resource. This feature lets you automatically assign roles to users based on their SAML attributes.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";

// Source the role
const roRole = datadog.getRole({
    filter: "Datadog Read Only Role",
});
// Create a new AuthN mapping
const devRoRoleMapping = new datadog.AuthnMapping("dev_ro_role_mapping", {
    key: "Member-of",
    value: "Development",
    role: roRole.then(roRole => roRole.id),
});
Copy
import pulumi
import pulumi_datadog as datadog

# Source the role
ro_role = datadog.get_role(filter="Datadog Read Only Role")
# Create a new AuthN mapping
dev_ro_role_mapping = datadog.AuthnMapping("dev_ro_role_mapping",
    key="Member-of",
    value="Development",
    role=ro_role.id)
Copy
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 role
		roRole, err := datadog.LookupRole(ctx, &datadog.LookupRoleArgs{
			Filter: "Datadog Read Only Role",
		}, nil)
		if err != nil {
			return err
		}
		// Create a new AuthN mapping
		_, err = datadog.NewAuthnMapping(ctx, "dev_ro_role_mapping", &datadog.AuthnMappingArgs{
			Key:   pulumi.String("Member-of"),
			Value: pulumi.String("Development"),
			Role:  pulumi.String(roRole.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;

return await Deployment.RunAsync(() => 
{
    // Source the role
    var roRole = Datadog.GetRole.Invoke(new()
    {
        Filter = "Datadog Read Only Role",
    });

    // Create a new AuthN mapping
    var devRoRoleMapping = new Datadog.AuthnMapping("dev_ro_role_mapping", new()
    {
        Key = "Member-of",
        Value = "Development",
        Role = roRole.Apply(getRoleResult => getRoleResult.Id),
    });

});
Copy
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.GetRoleArgs;
import com.pulumi.datadog.AuthnMapping;
import com.pulumi.datadog.AuthnMappingArgs;
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 role
        final var roRole = DatadogFunctions.getRole(GetRoleArgs.builder()
            .filter("Datadog Read Only Role")
            .build());

        // Create a new AuthN mapping
        var devRoRoleMapping = new AuthnMapping("devRoRoleMapping", AuthnMappingArgs.builder()
            .key("Member-of")
            .value("Development")
            .role(roRole.id())
            .build());

    }
}
Copy
resources:
  # Create a new AuthN mapping
  devRoRoleMapping:
    type: datadog:AuthnMapping
    name: dev_ro_role_mapping
    properties:
      key: Member-of
      value: Development
      role: ${roRole.id}
variables:
  # Source the role
  roRole:
    fn::invoke:
      function: datadog:getRole
      arguments:
        filter: Datadog Read Only Role
Copy

Create AuthnMapping Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AuthnMapping(name: string, args: AuthnMappingArgs, opts?: CustomResourceOptions);
@overload
def AuthnMapping(resource_name: str,
                 args: AuthnMappingArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def AuthnMapping(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 key: Optional[str] = None,
                 value: Optional[str] = None,
                 role: Optional[str] = None,
                 team: Optional[str] = None)
func NewAuthnMapping(ctx *Context, name string, args AuthnMappingArgs, opts ...ResourceOption) (*AuthnMapping, error)
public AuthnMapping(string name, AuthnMappingArgs args, CustomResourceOptions? opts = null)
public AuthnMapping(String name, AuthnMappingArgs args)
public AuthnMapping(String name, AuthnMappingArgs args, CustomResourceOptions options)
type: datadog:AuthnMapping
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AuthnMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AuthnMappingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AuthnMappingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AuthnMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AuthnMappingArgs
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 authnMappingResource = new Datadog.AuthnMapping("authnMappingResource", new()
{
    Key = "string",
    Value = "string",
    Role = "string",
    Team = "string",
});
Copy
example, err := datadog.NewAuthnMapping(ctx, "authnMappingResource", &datadog.AuthnMappingArgs{
	Key:   pulumi.String("string"),
	Value: pulumi.String("string"),
	Role:  pulumi.String("string"),
	Team:  pulumi.String("string"),
})
Copy
var authnMappingResource = new AuthnMapping("authnMappingResource", AuthnMappingArgs.builder()
    .key("string")
    .value("string")
    .role("string")
    .team("string")
    .build());
Copy
authn_mapping_resource = datadog.AuthnMapping("authnMappingResource",
    key="string",
    value="string",
    role="string",
    team="string")
Copy
const authnMappingResource = new datadog.AuthnMapping("authnMappingResource", {
    key: "string",
    value: "string",
    role: "string",
    team: "string",
});
Copy
type: datadog:AuthnMapping
properties:
    key: string
    role: string
    team: string
    value: string
Copy

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

Key This property is required. string
Identity provider key.
Value This property is required. string
Identity provider value.
Role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
Team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
Key This property is required. string
Identity provider key.
Value This property is required. string
Identity provider value.
Role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
Team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
key This property is required. String
Identity provider key.
value This property is required. String
Identity provider value.
role String
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team String
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
key This property is required. string
Identity provider key.
value This property is required. string
Identity provider value.
role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
key This property is required. str
Identity provider key.
value This property is required. str
Identity provider value.
role str
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team str
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
key This property is required. String
Identity provider key.
value This property is required. String
Identity provider value.
role String
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team String
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AuthnMapping Resource

Get an existing AuthnMapping 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?: AuthnMappingState, opts?: CustomResourceOptions): AuthnMapping
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        role: Optional[str] = None,
        team: Optional[str] = None,
        value: Optional[str] = None) -> AuthnMapping
func GetAuthnMapping(ctx *Context, name string, id IDInput, state *AuthnMappingState, opts ...ResourceOption) (*AuthnMapping, error)
public static AuthnMapping Get(string name, Input<string> id, AuthnMappingState? state, CustomResourceOptions? opts = null)
public static AuthnMapping get(String name, Output<String> id, AuthnMappingState state, CustomResourceOptions options)
resources:  _:    type: datadog:AuthnMapping    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Key string
Identity provider key.
Role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
Team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
Value string
Identity provider value.
Key string
Identity provider key.
Role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
Team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
Value string
Identity provider value.
key String
Identity provider key.
role String
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team String
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
value String
Identity provider value.
key string
Identity provider key.
role string
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team string
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
value string
Identity provider value.
key str
Identity provider key.
role str
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team str
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
value str
Identity provider value.
key String
Identity provider key.
role String
The ID of a role to attach to all users with the corresponding key and value. Cannot be used in conjunction with team.
team String
The ID of a team to add all users with the corresponding key and value to. Cannot be used in conjunction with role.
value String
Identity provider value.

Import

AuthN mappings can be imported using their ID, e.g.

$ pulumi import datadog:index/authnMapping:AuthnMapping dev_ro_mapping 000000-0000-0000-0000-000000000000
Copy

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 datadog Terraform Provider.