azurermDatadogMonitor
Manages a datadog Monitor.
Example Usage
Monitor creation with linking to Datadog organization
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West US 2",
name: "example-datadog",
}
);
const azurermDatadogMonitorExample = new azurerm.datadogMonitor.DatadogMonitor(
this,
"example_1",
{
datadog_organization: [
{
api_key: "XXXX",
application_key: "XXXX",
},
],
identity: [
{
type: "SystemAssigned",
},
],
location: azurermResourceGroupExample.location,
name: "example-monitor",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "Linked",
user: [
{
email: "abc@xyz.com",
name: "Example",
},
],
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDatadogMonitorExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) The name of the user that will be associated with the Datadog Monitor. Changing this forces a new Datadog Monitor to be created. -
resourceGroupName
- (Required) The name of the Resource Group where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created. -
location
- (Required) The Azure Region where the Datadog Monitor should exist. Changing this forces a new Datadog Monitor to be created. -
skuName
- (Required) The name which should be used for this sku. -
identity
- (Optional) Aidentity
block as defined below. -
user
- (Required) Auser
block as defined below. -
datadogOrganization
- (Required) AdatadogOrganization
block as defined below. -
monitoringEnabled
- (Optional) Is monitoring enabled? Defaults totrue
. -
tags
- (Optional) A mapping of tags which should be assigned to the Datadog Monitor.
A datadogOrganization
block exports the following:
-
apiKey
- (Required) Api key associated to the Datadog organization. Changing this forces a new Datadog Monitor to be created. -
applicationKey
- (Required) Application key associated to the Datadog organization. Changing this forces a new Datadog Monitor to be created. -
enterpriseAppId
- (Optional) The ID of the enterprise_app. Changing this forces a new resource to be created. -
linkingAuthCode
- (Optional) The auth code used to linking to an existing Datadog organization. Changing this forces a new Datadog Monitor to be created. -
linkingClientId
- (Optional) The ID of the linking_client. Changing this forces a new Datadog Monitor to be created. -
redirectUri
- (Optional) The redirect uri for linking. Changing this forces a new Datadog Monitor to be created.
An identity
block supports the following:
type
- (Required) Specifies the identity type of the Datadog Monitor. At this time the only allowed value issystemAssigned
.
NOTE: The assigned
principalId
andtenantId
can be retrieved after the identitytype
has been set tosystemAssigned
and the Datadog Monitor has been created. More details are available below.
An user
block exports the following:
-
name
- (Required) The name which should be used for this user_info. Changing this forces a new resource to be created. -
email
- (Required) Email of the user used by Datadog for contacting them if needed. Changing this forces a new Datadog Monitor to be created. -
phoneNumber
- (Optional) Phone number of the user used by Datadog for contacting them if needed. Changing this forces a new resource to be created.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
-
id
- The ID of the Datadog Monitor. -
identity
- Aidentity
block as defined below. -
marketplaceSubscriptionStatus
- Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state.
An identity
block exports the following:
-
principalId
- The Principal ID for the Service Principal associated with the Identity of this Datadog Monitor. -
tenantId
- The Tenant ID for the Service Principal associated with the Identity of this Datadog Monitor.
-> You can access the Principal ID via ${azurermDatadogMonitorExampleIdentity0PrincipalId}
and the Tenant ID via ${azurermDatadogMonitorExampleIdentity0TenantId}
Role Assignment
To enable metrics flow, perform role assignment on the identity created above. monitoringReader(43D0D8Ad25C7471493378Ba259A9Fe05)
role is required .
Role assignment on the monitor created
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermRoleDefinitionMonitoringReader =
new azurerm.dataAzurermRoleDefinition.DataAzurermRoleDefinition(
this,
"monitoring_reader",
{
name: "Monitoring Reader",
}
);
const dataAzurermSubscriptionPrimary =
new azurerm.dataAzurermSubscription.DataAzurermSubscription(
this,
"primary",
{}
);
new azurerm.roleAssignment.RoleAssignment(this, "example", {
principal_id: "${azurerm_datadog_monitor.example.identity.0.principal_id}",
role_definition_id:
dataAzurermRoleDefinitionMonitoringReader.roleDefinitionId,
scope: dataAzurermSubscriptionPrimary.id,
});
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Datadog Monitor.read
- (Defaults to 5 minutes) Used when retrieving the Datadog Monitor.update
- (Defaults to 30 minutes) Used when updating the Datadog Monitor.delete
- (Defaults to 30 minutes) Used when deleting the Datadog Monitor.
Import
Datadog Monitors can be imported using the resourceId
, e.g.