datadog.CloudConfigurationRule
Explore with Pulumi AI
Provides a Datadog Cloud Configuration Rule resource.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
var myrule = new Datadog.CloudConfigurationRule("myrule", new()
{
Enabled = true,
GroupBies = new[]
{
"@resource",
},
Message = "Rule has triggered",
Name = "My cloud configuration rule",
Notifications = new[]
{
"@channel",
},
Policy = @" package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = ""skip"" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = ""pass"" {
# Logic that evaluates to true if the resource is compliant
true
} else = ""fail"" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
",
RelatedResourceTypes = new[] {},
ResourceType = "aws_s3_bucket",
Severity = "high",
Tags = new[]
{
"some:tag",
},
});
});
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 {
_, err := datadog.NewCloudConfigurationRule(ctx, "myrule", &datadog.CloudConfigurationRuleArgs{
Enabled: pulumi.Bool(true),
GroupBies: pulumi.StringArray{
pulumi.String("@resource"),
},
Message: pulumi.String("Rule has triggered"),
Name: pulumi.String("My cloud configuration rule"),
Notifications: pulumi.StringArray{
pulumi.String("@channel"),
},
Policy: pulumi.String(` package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = "skip" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = "pass" {
# Logic that evaluates to true if the resource is compliant
true
} else = "fail" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
`),
RelatedResourceTypes: pulumi.StringArray{},
ResourceType: pulumi.String("aws_s3_bucket"),
Severity: pulumi.String("high"),
Tags: pulumi.StringArray{
pulumi.String("some:tag"),
},
})
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.CloudConfigurationRule;
import com.pulumi.datadog.CloudConfigurationRuleArgs;
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) {
var myrule = new CloudConfigurationRule("myrule", CloudConfigurationRuleArgs.builder()
.enabled(true)
.groupBies("@resource")
.message("Rule has triggered")
.name("My cloud configuration rule")
.notifications("@channel")
.policy("""
package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = "skip" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = "pass" {
# Logic that evaluates to true if the resource is compliant
true
} else = "fail" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
""")
.relatedResourceTypes()
.resourceType("aws_s3_bucket")
.severity("high")
.tags("some:tag")
.build());
}
}
import pulumi
import pulumi_datadog as datadog
myrule = datadog.CloudConfigurationRule("myrule",
enabled=True,
group_bies=["@resource"],
message="Rule has triggered",
name="My cloud configuration rule",
notifications=["@channel"],
policy=""" package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = "skip" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = "pass" {
# Logic that evaluates to true if the resource is compliant
true
} else = "fail" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
""",
related_resource_types=[],
resource_type="aws_s3_bucket",
severity="high",
tags=["some:tag"])
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
const myrule = new datadog.CloudConfigurationRule("myrule", {
enabled: true,
groupBies: ["@resource"],
message: "Rule has triggered",
name: "My cloud configuration rule",
notifications: ["@channel"],
policy: ` package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = "skip" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = "pass" {
# Logic that evaluates to true if the resource is compliant
true
} else = "fail" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
`,
relatedResourceTypes: [],
resourceType: "aws_s3_bucket",
severity: "high",
tags: ["some:tag"],
});
resources:
myrule:
type: datadog:CloudConfigurationRule
properties:
enabled: true
groupBies:
- '@resource'
message: Rule has triggered
name: My cloud configuration rule
notifications:
- '@channel'
policy: |2+
package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
eval(resource) = "skip" if {
# Logic that evaluates to true if the resource should be skipped
true
} else = "pass" {
# Logic that evaluates to true if the resource is compliant
true
} else = "fail" {
# Logic that evaluates to true if the resource is not compliant
true
}
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
relatedResourceTypes: []
resourceType: aws_s3_bucket
severity: high
tags:
- some:tag
Create CloudConfigurationRule Resource
new CloudConfigurationRule(name: string, args: CloudConfigurationRuleArgs, opts?: CustomResourceOptions);
@overload
def CloudConfigurationRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
enabled: Optional[bool] = None,
filters: Optional[Sequence[CloudConfigurationRuleFilterArgs]] = None,
group_bies: Optional[Sequence[str]] = None,
message: Optional[str] = None,
name: Optional[str] = None,
notifications: Optional[Sequence[str]] = None,
policy: Optional[str] = None,
related_resource_types: Optional[Sequence[str]] = None,
resource_type: Optional[str] = None,
severity: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
@overload
def CloudConfigurationRule(resource_name: str,
args: CloudConfigurationRuleArgs,
opts: Optional[ResourceOptions] = None)
func NewCloudConfigurationRule(ctx *Context, name string, args CloudConfigurationRuleArgs, opts ...ResourceOption) (*CloudConfigurationRule, error)
public CloudConfigurationRule(string name, CloudConfigurationRuleArgs args, CustomResourceOptions? opts = null)
public CloudConfigurationRule(String name, CloudConfigurationRuleArgs args)
public CloudConfigurationRule(String name, CloudConfigurationRuleArgs args, CustomResourceOptions options)
type: datadog:CloudConfigurationRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CloudConfigurationRuleArgs
- 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 CloudConfigurationRuleArgs
- 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 CloudConfigurationRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CloudConfigurationRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CloudConfigurationRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
CloudConfigurationRule 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 CloudConfigurationRule resource accepts the following input properties:
- Enabled bool
Whether the cloud configuration rule is enabled.
- Message string
The message associated to the rule that will be shown in findings and signals.
- Name string
The name of the cloud configuration rule.
- Policy string
Policy written in Rego format.
- Resource
Type string Main resource type to be checked by the rule.
- Severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- Filters
List<Cloud
Configuration Rule Filter> Additional queries to filter matched events before they are processed. Defaults to empty list
- Group
Bies List<string> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- Notifications List<string>
Notification targets for signals. Defaults to empty list.
- List<string>
Related resource types to be checked by the rule. Defaults to empty list.
- List<string>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- Enabled bool
Whether the cloud configuration rule is enabled.
- Message string
The message associated to the rule that will be shown in findings and signals.
- Name string
The name of the cloud configuration rule.
- Policy string
Policy written in Rego format.
- Resource
Type string Main resource type to be checked by the rule.
- Severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- Filters
[]Cloud
Configuration Rule Filter Args Additional queries to filter matched events before they are processed. Defaults to empty list
- Group
Bies []string Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- Notifications []string
Notification targets for signals. Defaults to empty list.
- []string
Related resource types to be checked by the rule. Defaults to empty list.
- []string
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled Boolean
Whether the cloud configuration rule is enabled.
- message String
The message associated to the rule that will be shown in findings and signals.
- name String
The name of the cloud configuration rule.
- policy String
Policy written in Rego format.
- resource
Type String Main resource type to be checked by the rule.
- severity String
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- filters
List<Cloud
Configuration Rule Filter> Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies List<String> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- notifications List<String>
Notification targets for signals. Defaults to empty list.
- List<String>
Related resource types to be checked by the rule. Defaults to empty list.
- List<String>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled boolean
Whether the cloud configuration rule is enabled.
- message string
The message associated to the rule that will be shown in findings and signals.
- name string
The name of the cloud configuration rule.
- policy string
Policy written in Rego format.
- resource
Type string Main resource type to be checked by the rule.
- severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- filters
Cloud
Configuration Rule Filter[] Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies string[] Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- notifications string[]
Notification targets for signals. Defaults to empty list.
- string[]
Related resource types to be checked by the rule. Defaults to empty list.
- string[]
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled bool
Whether the cloud configuration rule is enabled.
- message str
The message associated to the rule that will be shown in findings and signals.
- name str
The name of the cloud configuration rule.
- policy str
Policy written in Rego format.
- resource_
type str Main resource type to be checked by the rule.
- severity str
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- filters
Sequence[Cloud
Configuration Rule Filter Args] Additional queries to filter matched events before they are processed. Defaults to empty list
- group_
bies Sequence[str] Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- notifications Sequence[str]
Notification targets for signals. Defaults to empty list.
- Sequence[str]
Related resource types to be checked by the rule. Defaults to empty list.
- Sequence[str]
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled Boolean
Whether the cloud configuration rule is enabled.
- message String
The message associated to the rule that will be shown in findings and signals.
- name String
The name of the cloud configuration rule.
- policy String
Policy written in Rego format.
- resource
Type String Main resource type to be checked by the rule.
- severity String
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- filters List<Property Map>
Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies List<String> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- notifications List<String>
Notification targets for signals. Defaults to empty list.
- List<String>
Related resource types to be checked by the rule. Defaults to empty list.
- List<String>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
Outputs
All input properties are implicitly available as output properties. Additionally, the CloudConfigurationRule 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 CloudConfigurationRule Resource
Get an existing CloudConfigurationRule 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?: CloudConfigurationRuleState, opts?: CustomResourceOptions): CloudConfigurationRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
enabled: Optional[bool] = None,
filters: Optional[Sequence[CloudConfigurationRuleFilterArgs]] = None,
group_bies: Optional[Sequence[str]] = None,
message: Optional[str] = None,
name: Optional[str] = None,
notifications: Optional[Sequence[str]] = None,
policy: Optional[str] = None,
related_resource_types: Optional[Sequence[str]] = None,
resource_type: Optional[str] = None,
severity: Optional[str] = None,
tags: Optional[Sequence[str]] = None) -> CloudConfigurationRule
func GetCloudConfigurationRule(ctx *Context, name string, id IDInput, state *CloudConfigurationRuleState, opts ...ResourceOption) (*CloudConfigurationRule, error)
public static CloudConfigurationRule Get(string name, Input<string> id, CloudConfigurationRuleState? state, CustomResourceOptions? opts = null)
public static CloudConfigurationRule get(String name, Output<String> id, CloudConfigurationRuleState 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.
- Enabled bool
Whether the cloud configuration rule is enabled.
- Filters
List<Cloud
Configuration Rule Filter> Additional queries to filter matched events before they are processed. Defaults to empty list
- Group
Bies List<string> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- Message string
The message associated to the rule that will be shown in findings and signals.
- Name string
The name of the cloud configuration rule.
- Notifications List<string>
Notification targets for signals. Defaults to empty list.
- Policy string
Policy written in Rego format.
- List<string>
Related resource types to be checked by the rule. Defaults to empty list.
- Resource
Type string Main resource type to be checked by the rule.
- Severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- List<string>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- Enabled bool
Whether the cloud configuration rule is enabled.
- Filters
[]Cloud
Configuration Rule Filter Args Additional queries to filter matched events before they are processed. Defaults to empty list
- Group
Bies []string Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- Message string
The message associated to the rule that will be shown in findings and signals.
- Name string
The name of the cloud configuration rule.
- Notifications []string
Notification targets for signals. Defaults to empty list.
- Policy string
Policy written in Rego format.
- []string
Related resource types to be checked by the rule. Defaults to empty list.
- Resource
Type string Main resource type to be checked by the rule.
- Severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- []string
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled Boolean
Whether the cloud configuration rule is enabled.
- filters
List<Cloud
Configuration Rule Filter> Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies List<String> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- message String
The message associated to the rule that will be shown in findings and signals.
- name String
The name of the cloud configuration rule.
- notifications List<String>
Notification targets for signals. Defaults to empty list.
- policy String
Policy written in Rego format.
- List<String>
Related resource types to be checked by the rule. Defaults to empty list.
- resource
Type String Main resource type to be checked by the rule.
- severity String
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- List<String>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled boolean
Whether the cloud configuration rule is enabled.
- filters
Cloud
Configuration Rule Filter[] Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies string[] Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- message string
The message associated to the rule that will be shown in findings and signals.
- name string
The name of the cloud configuration rule.
- notifications string[]
Notification targets for signals. Defaults to empty list.
- policy string
Policy written in Rego format.
- string[]
Related resource types to be checked by the rule. Defaults to empty list.
- resource
Type string Main resource type to be checked by the rule.
- severity string
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- string[]
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled bool
Whether the cloud configuration rule is enabled.
- filters
Sequence[Cloud
Configuration Rule Filter Args] Additional queries to filter matched events before they are processed. Defaults to empty list
- group_
bies Sequence[str] Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- message str
The message associated to the rule that will be shown in findings and signals.
- name str
The name of the cloud configuration rule.
- notifications Sequence[str]
Notification targets for signals. Defaults to empty list.
- policy str
Policy written in Rego format.
- Sequence[str]
Related resource types to be checked by the rule. Defaults to empty list.
- resource_
type str Main resource type to be checked by the rule.
- severity str
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- Sequence[str]
Tags of the rule, propagated to findings and signals. Defaults to empty list.
- enabled Boolean
Whether the cloud configuration rule is enabled.
- filters List<Property Map>
Additional queries to filter matched events before they are processed. Defaults to empty list
- group
Bies List<String> Fields to group by when generating signals, e.g. @resource. Defaults to empty list.
- message String
The message associated to the rule that will be shown in findings and signals.
- name String
The name of the cloud configuration rule.
- notifications List<String>
Notification targets for signals. Defaults to empty list.
- policy String
Policy written in Rego format.
- List<String>
Related resource types to be checked by the rule. Defaults to empty list.
- resource
Type String Main resource type to be checked by the rule.
- severity String
Severity of the rule and associated signals. Valid values are
info
,low
,medium
,high
,critical
.- List<String>
Tags of the rule, propagated to findings and signals. Defaults to empty list.
Supporting Types
CloudConfigurationRuleFilter, CloudConfigurationRuleFilterArgs
Import
Security monitoring rules can be imported using ID, e.g.
$ pulumi import datadog:index/cloudConfigurationRule:CloudConfigurationRule my_rule m0o-hto-lkb
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
datadog
Terraform Provider.