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
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
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 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 {
roRole, err := datadog.LookupRole(ctx, &datadog.LookupRoleArgs{
Filter: "Datadog Read Only Role",
}, nil)
if err != nil {
return err
}
_, 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
})
}
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) {
final var roRole = DatadogFunctions.getRole(GetRoleArgs.builder()
.filter("Datadog Read Only Role")
.build());
var bar = new ServiceAccount("bar", ServiceAccountArgs.builder()
.email("new@example.com")
.name("Service Account Bar")
.roles(roRole.applyValue(getRoleResult -> getRoleResult.id()))
.build());
}
}
import pulumi
import pulumi_datadog as datadog
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])
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
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)],
});
resources:
# Create a new Datadog service account
bar:
type: datadog:ServiceAccount
properties:
email: new@example.com
name: Service Account Bar
roles:
- ${roRole.id}
variables:
roRole:
fn::invoke:
Function: datadog:getRole
Arguments:
filter: Datadog Read Only Role
Create ServiceAccount Resource
new ServiceAccount(name: string, args: ServiceAccountArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccount(resource_name: str,
opts: Optional[ResourceOptions] = None,
disabled: Optional[bool] = None,
email: Optional[str] = None,
name: Optional[str] = None,
roles: Optional[Sequence[str]] = None)
@overload
def ServiceAccount(resource_name: str,
args: ServiceAccountArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
datadog
Terraform Provider.