datadog.ServiceAccount
Explore with Pulumi AI
Provides a Datadog service account resource. This can be used to create and manage Datadog service accounts.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
// Source a role
const roRole = datadog.getRole({
filter: "Datadog Read Only Role",
});
// Create a new Datadog service account
const bar = new datadog.ServiceAccount("bar", {
email: "new@example.com",
name: "Service Account Bar",
roles: [roRole.then(roRole => roRole.id)],
});
import pulumi
import pulumi_datadog as datadog
# Source a role
ro_role = datadog.get_role(filter="Datadog Read Only Role")
# Create a new Datadog service account
bar = datadog.ServiceAccount("bar",
email="new@example.com",
name="Service Account Bar",
roles=[ro_role.id])
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 a role
roRole, err := datadog.LookupRole(ctx, &datadog.LookupRoleArgs{
Filter: "Datadog Read Only Role",
}, nil)
if err != nil {
return err
}
// Create a new Datadog service account
_, err = datadog.NewServiceAccount(ctx, "bar", &datadog.ServiceAccountArgs{
Email: pulumi.String("new@example.com"),
Name: pulumi.String("Service Account Bar"),
Roles: pulumi.StringArray{
pulumi.String(roRole.Id),
},
})
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 a role
var roRole = Datadog.GetRole.Invoke(new()
{
Filter = "Datadog Read Only Role",
});
// Create a new Datadog service account
var bar = new Datadog.ServiceAccount("bar", new()
{
Email = "new@example.com",
Name = "Service Account Bar",
Roles = new[]
{
roRole.Apply(getRoleResult => getRoleResult.Id),
},
});
});
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.ServiceAccount;
import com.pulumi.datadog.ServiceAccountArgs;
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 a role
final var roRole = DatadogFunctions.getRole(GetRoleArgs.builder()
.filter("Datadog Read Only Role")
.build());
// Create a new Datadog service account
var bar = new ServiceAccount("bar", ServiceAccountArgs.builder()
.email("new@example.com")
.name("Service Account Bar")
.roles(roRole.applyValue(getRoleResult -> getRoleResult.id()))
.build());
}
}
resources:
# Create a new Datadog service account
bar:
type: datadog:ServiceAccount
properties:
email: new@example.com
name: Service Account Bar
roles:
- ${roRole.id}
variables:
# Source a role
roRole:
fn::invoke:
Function: datadog:getRole
Arguments:
filter: Datadog Read Only Role
Create ServiceAccount Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceAccount(name: string, args: ServiceAccountArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccount(resource_name: str,
args: ServiceAccountArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceAccount(resource_name: str,
opts: Optional[ResourceOptions] = None,
email: Optional[str] = None,
disabled: Optional[bool] = None,
name: Optional[str] = None,
roles: Optional[Sequence[str]] = None)
func NewServiceAccount(ctx *Context, name string, args ServiceAccountArgs, opts ...ResourceOption) (*ServiceAccount, error)
public ServiceAccount(string name, ServiceAccountArgs args, CustomResourceOptions? opts = null)
public ServiceAccount(String name, ServiceAccountArgs args)
public ServiceAccount(String name, ServiceAccountArgs args, CustomResourceOptions options)
type: datadog:ServiceAccount
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 ServiceAccountArgs
- 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 ServiceAccountArgs
- 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 ServiceAccountArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceAccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceAccountArgs
- 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 serviceAccountResource = new Datadog.ServiceAccount("serviceAccountResource", new()
{
Email = "string",
Disabled = false,
Name = "string",
Roles = new[]
{
"string",
},
});
example, err := datadog.NewServiceAccount(ctx, "serviceAccountResource", &datadog.ServiceAccountArgs{
Email: pulumi.String("string"),
Disabled: pulumi.Bool(false),
Name: pulumi.String("string"),
Roles: pulumi.StringArray{
pulumi.String("string"),
},
})
var serviceAccountResource = new ServiceAccount("serviceAccountResource", ServiceAccountArgs.builder()
.email("string")
.disabled(false)
.name("string")
.roles("string")
.build());
service_account_resource = datadog.ServiceAccount("serviceAccountResource",
email="string",
disabled=False,
name="string",
roles=["string"])
const serviceAccountResource = new datadog.ServiceAccount("serviceAccountResource", {
email: "string",
disabled: false,
name: "string",
roles: ["string"],
});
type: datadog:ServiceAccount
properties:
disabled: false
email: string
name: string
roles:
- string
ServiceAccount Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ServiceAccount resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ServiceAccount 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 ServiceAccount Resource
Get an existing ServiceAccount 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?: ServiceAccountState, opts?: CustomResourceOptions): ServiceAccount
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
disabled: Optional[bool] = None,
email: Optional[str] = None,
name: Optional[str] = None,
roles: Optional[Sequence[str]] = None) -> ServiceAccount
func GetServiceAccount(ctx *Context, name string, id IDInput, state *ServiceAccountState, opts ...ResourceOption) (*ServiceAccount, error)
public static ServiceAccount Get(string name, Input<string> id, ServiceAccountState? state, CustomResourceOptions? opts = null)
public static ServiceAccount get(String name, Output<String> id, ServiceAccountState 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.
Import
$ pulumi import datadog:index/serviceAccount:ServiceAccount example_sa 6f1b44c0-30b2-11eb-86bc-279f7c1ebaa4
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.